summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorPeter Kuemmel <syntheticpp@gmx.net>2012-07-01 22:01:41 (GMT)
committerPeter Kuemmel <syntheticpp@gmx.net>2012-07-01 22:01:41 (GMT)
commit0c42faf63acadf320ea6371d42d03386e1c20176 (patch)
tree24b54fb4d81b3cd6376aa981bf830d58e4e5b411 /Source
parentba41a238f708da78d0f053bfba1e7d9c70369a16 (diff)
downloadCMake-0c42faf63acadf320ea6371d42d03386e1c20176.zip
CMake-0c42faf63acadf320ea6371d42d03386e1c20176.tar.gz
CMake-0c42faf63acadf320ea6371d42d03386e1c20176.tar.bz2
Ninja: also consider variables when checking command line length
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx39
-rw-r--r--Source/cmLocalNinjaGenerator.cxx2
2 files changed, 21 insertions, 20 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index c3989c0..6e8ce87 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";
-
- os << builds.str() << args;
+ if (cmdLineLimit > 0
+ && args.size() + buildstr.size() + assignments.size()
+ > (size_t) cmdLineLimit)
+ buildstr += "_RSPFILE";
- // 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,
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 9a496f2..ea9c406 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -272,7 +272,7 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
// don't use POST_BUILD.
if (cmdLines.empty())
#ifdef _WIN32
- return "cd.";
+ return "cd .";
#else
return ":";
#endif