cmGlobalNinjaGenerator: Clarify logic for forcing use of response files

Update the WriteBuild method to use a negative command line length limit
to specify that we should force use of response files.
This commit is contained in:
Dmitry Ivanov 2016-04-06 12:55:15 +02:00 committed by Brad King
parent 24c9106b7b
commit f9644a2d1b
3 changed files with 6 additions and 5 deletions

View File

@ -230,9 +230,10 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
std::string assignments = variable_assignments.str(); std::string assignments = variable_assignments.str();
const std::string& args = arguments; const std::string& args = arguments;
bool useResponseFile = false; bool useResponseFile = false;
if (cmdLineLimit > 0 if (cmdLineLimit < 0 ||
&& args.size() + buildstr.size() + assignments.size() (cmdLineLimit > 0 &&
> (size_t) cmdLineLimit) { (args.size() + buildstr.size() + assignments.size())
> static_cast<size_t>(cmdLineLimit))) {
variable_assignments.str(std::string()); variable_assignments.str(std::string());
cmGlobalNinjaGenerator::WriteVariable(variable_assignments, cmGlobalNinjaGenerator::WriteVariable(variable_assignments,
"RSP_FILE", rspfile, "", 1); "RSP_FILE", rspfile, "", 1);

View File

@ -94,7 +94,7 @@ public:
const cmNinjaDeps& orderOnlyDeps, const cmNinjaDeps& orderOnlyDeps,
const cmNinjaVars& variables, const cmNinjaVars& variables,
const std::string& rspfile = std::string(), const std::string& rspfile = std::string(),
int cmdLineLimit = -1, int cmdLineLimit = 0,
bool* usedResponseFile = 0); bool* usedResponseFile = 0);
/** /**

View File

@ -697,7 +697,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator(); cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator();
int commandLineLengthLimit = 1; int commandLineLengthLimit = -1;
if (!this->ForceResponseFile()) if (!this->ForceResponseFile())
{ {
commandLineLengthLimit = calculateCommandLineLengthLimit( commandLineLengthLimit = calculateCommandLineLengthLimit(