summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-07-09 18:23:47 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-07-09 18:23:47 (GMT)
commitada7fe248a0b0c50a3487150cdfc2add6e8f8b22 (patch)
tree117bed70e907288dd331de73c5fdebef5401cb49 /Source/cmGlobalNinjaGenerator.cxx
parentcdc00f0f7ef6c28540a1755573b477690501ee7f (diff)
parent6332ba5a58f0114d1763c263950eae20b09eaa4b (diff)
downloadCMake-ada7fe248a0b0c50a3487150cdfc2add6e8f8b22.zip
CMake-ada7fe248a0b0c50a3487150cdfc2add6e8f8b22.tar.gz
CMake-ada7fe248a0b0c50a3487150cdfc2add6e8f8b22.tar.bz2
Merge topic 'ninja-cmdLineLimit'
6332ba5 Ninja: also consider rule command length for rsp file 0c42faf Ninja: also consider variables when checking command line length
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx41
1 files changed, 22 insertions, 19 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index af61d95..6392ecd 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -160,34 +160,35 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
arguments << "\n";
-
- cmOStringStream builds;
+ cmOStringStream build;
// Write outputs files.
- builds << "build";
+ build << "build";
for(cmNinjaDeps::const_iterator i = outputs.begin();
- i != outputs.end();
- ++i)
- builds << " " << EncodeIdent(EncodePath(*i), os);
- builds << ":";
-
+ i != outputs.end(); ++i)
+ build << " " << EncodeIdent(EncodePath(*i), os);
+ build << ":";
// Write the rule.
- builds << " " << rule;
+ build << " " << rule;
+
+ // Write the variables bound to this build statement.
+ cmOStringStream variable_assignments;
+ for(cmNinjaVars::const_iterator i = variables.begin();
+ i != variables.end(); ++i)
+ cmGlobalNinjaGenerator::WriteVariable(variable_assignments,
+ i->first, i->second, "", 1);
// check if a response file rule should be used
+ std::string buildstr = build.str();
+ const std::string assignments = variable_assignments.str();
const std::string args = arguments.str();
- if (cmdLineLimit > 0 &&
- (args.size() + + builds.str().size()) > (size_t)cmdLineLimit)
- builds << "_RSPFILE";
+ if (cmdLineLimit > 0
+ && args.size() + buildstr.size() + assignments.size()
+ > (size_t) cmdLineLimit)
+ buildstr += "_RSPFILE";
- os << builds.str() << args;
-
- // Write the variables bound to this build statement.
- for(cmNinjaVars::const_iterator i = variables.begin();
- i != variables.end();
- ++i)
- cmGlobalNinjaGenerator::WriteVariable(os, i->first, i->second, "", 1);
+ os << buildstr << args << assignments;
}
void cmGlobalNinjaGenerator::WritePhonyBuild(std::ostream& os,
@@ -556,6 +557,8 @@ void cmGlobalNinjaGenerator::AddRule(const std::string& name,
rspfile,
restat,
generator);
+
+ this->RuleCmdLength[name] = command.size();
}
bool cmGlobalNinjaGenerator::HasRule(const std::string &name)