summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.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/cmMakefileTargetGenerator.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/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 923aa7b..402dfc6 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -769,6 +769,25 @@ cmMakefileTargetGenerator
}
}
+ // Maybe insert a compiler launcher like ccache or distcc
+ if (!compileCommands.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, " ") + " ";
+ compileCommands.front().insert(0, run_launcher);
+ }
+ }
+
// Expand placeholders in the commands.
for(std::vector<std::string>::iterator i = compileCommands.begin();
i != compileCommands.end(); ++i)