summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorPeter Kuemmel <syntheticpp@gmx.net>2012-06-14 12:15:16 (GMT)
committerPeter Kuemmel <syntheticpp@gmx.net>2012-06-14 12:22:56 (GMT)
commit654608600474a27eeddafd50ea25c7e3882fd460 (patch)
treeb666e0b55bbc137f5d631504cec812136607e854 /Source/cmLocalNinjaGenerator.cxx
parent220fdc16fc577feb3401a44eea475dae119257b0 (diff)
downloadCMake-654608600474a27eeddafd50ea25c7e3882fd460.zip
CMake-654608600474a27eeddafd50ea25c7e3882fd460.tar.gz
CMake-654608600474a27eeddafd50ea25c7e3882fd460.tar.bz2
Ninja: don't use shell when cmake is called directly
When linking with cmake and vs_link_* the command line could be too long for cmd.exe, which needs not to be called in this case. (was not cached by a test) Introduce rules which don't use the shell and use this rule when there are no pre or post step. For free we get a small speedup, because cmd is then not called. Also be more accurate when estimating the command line length.
Diffstat (limited to 'Source/cmLocalNinjaGenerator.cxx')
-rw-r--r--Source/cmLocalNinjaGenerator.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index 5d193cd..71f0913 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -264,6 +264,14 @@ void cmLocalNinjaGenerator::AppendCustomCommandDeps(const cmCustomCommand *cc,
}
}
+std::string cmLocalNinjaGenerator::nopCommand() const {
+#ifdef _WIN32
+ return "cd .";
+#else
+ return ":";
+#endif
+}
+
std::string cmLocalNinjaGenerator::BuildCommandLine(
const std::vector<std::string> &cmdLines)
{
@@ -272,9 +280,10 @@ std::string cmLocalNinjaGenerator::BuildCommandLine(
// don't use POST_BUILD.
if (cmdLines.empty())
#ifdef _WIN32
- return "cd.";
+ return "";
#else
- return ":";
+ // TODO use _NOSHELL rule also on Linux
+ return nopCommand();
#endif
std::ostringstream cmd;