diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index f12396f50..fadb0cf82 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -230,9 +230,10 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os, std::string assignments = variable_assignments.str(); const std::string& args = arguments; bool useResponseFile = false; - if (cmdLineLimit > 0 - && args.size() + buildstr.size() + assignments.size() - > (size_t) cmdLineLimit) { + if (cmdLineLimit < 0 || + (cmdLineLimit > 0 && + (args.size() + buildstr.size() + assignments.size()) + > static_cast(cmdLineLimit))) { variable_assignments.str(std::string()); cmGlobalNinjaGenerator::WriteVariable(variable_assignments, "RSP_FILE", rspfile, "", 1); diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 3023a95c6..3093a1113 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -94,7 +94,7 @@ public: const cmNinjaDeps& orderOnlyDeps, const cmNinjaVars& variables, const std::string& rspfile = std::string(), - int cmdLineLimit = -1, + int cmdLineLimit = 0, bool* usedResponseFile = 0); /** diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 54cacef0b..322f37d2f 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -697,7 +697,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator(); - int commandLineLengthLimit = 1; + int commandLineLengthLimit = -1; if (!this->ForceResponseFile()) { commandLineLengthLimit = calculateCommandLineLengthLimit(