Ninja: don't confuse ninja's rsp files with nmake's
Move response files into CMakeFiles/ which makes them different to nmake's.
This commit is contained in:
parent
64d64b4edf
commit
f1670ab18a
|
@ -106,6 +106,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
|
||||||
const cmNinjaDeps& implicitDeps,
|
const cmNinjaDeps& implicitDeps,
|
||||||
const cmNinjaDeps& orderOnlyDeps,
|
const cmNinjaDeps& orderOnlyDeps,
|
||||||
const cmNinjaVars& variables,
|
const cmNinjaVars& variables,
|
||||||
|
const std::string& rspfile,
|
||||||
int cmdLineLimit)
|
int cmdLineLimit)
|
||||||
{
|
{
|
||||||
// Make sure there is a rule.
|
// Make sure there is a rule.
|
||||||
|
@ -181,12 +182,17 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
|
||||||
|
|
||||||
// check if a response file rule should be used
|
// check if a response file rule should be used
|
||||||
std::string buildstr = build.str();
|
std::string buildstr = build.str();
|
||||||
const std::string assignments = variable_assignments.str();
|
std::string assignments = variable_assignments.str();
|
||||||
const std::string args = arguments.str();
|
const std::string args = arguments.str();
|
||||||
if (cmdLineLimit > 0
|
if (cmdLineLimit > 0
|
||||||
&& args.size() + buildstr.size() + assignments.size()
|
&& args.size() + buildstr.size() + assignments.size()
|
||||||
> (size_t) cmdLineLimit)
|
> (size_t) cmdLineLimit) {
|
||||||
buildstr += "_RSPFILE";
|
buildstr += "_RSP_FILE";
|
||||||
|
variable_assignments.clear();
|
||||||
|
cmGlobalNinjaGenerator::WriteVariable(variable_assignments,
|
||||||
|
"RSP_FILE", rspfile, "", 1);
|
||||||
|
assignments += variable_assignments.str();
|
||||||
|
}
|
||||||
|
|
||||||
os << buildstr << args << assignments;
|
os << buildstr << args << assignments;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ public:
|
||||||
const cmNinjaDeps& implicitDeps,
|
const cmNinjaDeps& implicitDeps,
|
||||||
const cmNinjaDeps& orderOnlyDeps,
|
const cmNinjaDeps& orderOnlyDeps,
|
||||||
const cmNinjaVars& variables,
|
const cmNinjaVars& variables,
|
||||||
|
const std::string& rspfile = std::string(),
|
||||||
int cmdLineLimit = -1);
|
int cmdLineLimit = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -153,7 +153,7 @@ cmNinjaNormalTargetGenerator
|
||||||
cmTarget::TargetType targetType = this->GetTarget()->GetType();
|
cmTarget::TargetType targetType = this->GetTarget()->GetType();
|
||||||
std::string ruleName = this->LanguageLinkerRule();
|
std::string ruleName = this->LanguageLinkerRule();
|
||||||
if (useResponseFile)
|
if (useResponseFile)
|
||||||
ruleName += "_RSPFILE";
|
ruleName += "_RSP_FILE";
|
||||||
|
|
||||||
// Select whether to use a response file for objects.
|
// Select whether to use a response file for objects.
|
||||||
std::string rspfile;
|
std::string rspfile;
|
||||||
|
@ -179,7 +179,7 @@ cmNinjaNormalTargetGenerator
|
||||||
} else {
|
} else {
|
||||||
responseFlag = "@";
|
responseFlag = "@";
|
||||||
}
|
}
|
||||||
rspfile = "$out.rsp";
|
rspfile = "$RSP_FILE";
|
||||||
responseFlag += rspfile;
|
responseFlag += rspfile;
|
||||||
rspcontent = "$in $LINK_LIBRARIES";
|
rspcontent = "$in $LINK_LIBRARIES";
|
||||||
vars.Objects = responseFlag.c_str();
|
vars.Objects = responseFlag.c_str();
|
||||||
|
@ -549,6 +549,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
int commandLineLengthLimit = -1;
|
int commandLineLengthLimit = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const std::string rspfile = std::string
|
||||||
|
(cmake::GetCMakeFilesDirectoryPostSlash()) +
|
||||||
|
this->GetTarget()->GetName() + ".rsp";
|
||||||
|
|
||||||
// Write the build statement for this target.
|
// Write the build statement for this target.
|
||||||
cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(),
|
cmGlobalNinjaGenerator::WriteBuild(this->GetBuildFileStream(),
|
||||||
comment.str(),
|
comment.str(),
|
||||||
|
@ -558,6 +562,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
|
||||||
implicitDeps,
|
implicitDeps,
|
||||||
emptyDeps,
|
emptyDeps,
|
||||||
vars,
|
vars,
|
||||||
|
rspfile,
|
||||||
commandLineLengthLimit);
|
commandLineLengthLimit);
|
||||||
|
|
||||||
if (targetOutput != targetOutputReal) {
|
if (targetOutput != targetOutputReal) {
|
||||||
|
|
Loading…
Reference in New Issue