summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-06-15 13:45:28 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-06-15 13:45:28 (GMT)
commitc1113705d7469e87f1f988ea1c86f0bbf96dd219 (patch)
tree0ae8d92d79baf81718eecb3894c663097a0b28a3 /Source/cmNinjaTargetGenerator.cxx
parent919b116f98f20e685999ab8e94415c11228d7d88 (diff)
parent698f75971bee336133d21260db069bb139bd3d76 (diff)
downloadCMake-c1113705d7469e87f1f988ea1c86f0bbf96dd219.zip
CMake-c1113705d7469e87f1f988ea1c86f0bbf96dd219.tar.gz
CMake-c1113705d7469e87f1f988ea1c86f0bbf96dd219.tar.bz2
Merge topic 'compiler-launcher'
698f7597 Add options to launch the compiler through tools like ccache or distcc
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index b2aef68..6e35cd4 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -22,6 +22,7 @@
#include "cmComputeLinkInformation.h"
#include "cmSourceFile.h"
#include "cmCustomCommandGenerator.h"
+#include "cmAlgorithms.h"
#include <algorithm>
@@ -476,6 +477,25 @@ cmNinjaTargetGenerator
}
}
+ // Maybe insert a compiler launcher like ccache or distcc
+ if (!compileCmds.empty() && (lang == "C" || lang == "CXX"))
+ {
+ std::string const clauncher_prop = lang + "_COMPILER_LAUNCHER";
+ const char *clauncher = this->Target->GetProperty(clauncher_prop);
+ if (clauncher && *clauncher)
+ {
+ std::vector<std::string> launcher_cmd;
+ cmSystemTools::ExpandListArgument(clauncher, launcher_cmd, true);
+ for (std::vector<std::string>::iterator i = launcher_cmd.begin(),
+ e = launcher_cmd.end(); i != e; ++i)
+ {
+ *i = this->LocalGenerator->EscapeForShell(*i);
+ }
+ std::string const& run_launcher = cmJoin(launcher_cmd, " ") + " ";
+ compileCmds.front().insert(0, run_launcher);
+ }
+ }
+
if (!compileCmds.empty())
{
compileCmds.front().insert(0, cldeps);