summaryrefslogtreecommitdiffstats
path: root/Source/cmcmd.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-02-28 13:16:52 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-02-28 13:17:33 (GMT)
commit82de05088f762371c6cd753ae19533dc9f5cd6b2 (patch)
tree011da5bf508f8f36e1d29e5a3fb0793a028e6f21 /Source/cmcmd.cxx
parent74dac86c7625b1c33ccc564155a7f8982f1ce67f (diff)
parenteaf9f69d41961353bf0fc9d63c543f957692d714 (diff)
downloadCMake-82de05088f762371c6cd753ae19533dc9f5cd6b2.zip
CMake-82de05088f762371c6cd753ae19533dc9f5cd6b2.tar.gz
CMake-82de05088f762371c6cd753ae19533dc9f5cd6b2.tar.bz2
Merge topic 'co-compile-with-launcher'
eaf9f69d41 Fix combined use of compiler launcher with lint tools Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1791
Diffstat (limited to 'Source/cmcmd.cxx')
-rw-r--r--Source/cmcmd.cxx26
1 files changed, 17 insertions, 9 deletions
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index e7d92d4..6f3a90f 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -359,7 +359,8 @@ struct CoCompileJob
int cmcmd::HandleCoCompileCommands(std::vector<std::string>& args)
{
std::vector<CoCompileJob> jobs;
- std::string sourceFile; // store --source=
+ std::string sourceFile; // store --source=
+ std::vector<std::string> launchers; // store --launcher=
// Default is to run the original command found after -- if the option
// does not need to do that, it should be specified here, currently only
@@ -390,15 +391,17 @@ int cmcmd::HandleCoCompileCommands(std::vector<std::string>& args)
}
}
}
- if (cmHasLiteralPrefix(arg, "--source=")) {
- sourceFile = arg.substr(9);
- optionFound = true;
- }
- // if it was not a co-compiler or --source then error
if (!optionFound) {
- std::cerr << "__run_co_compile given unknown argument: " << arg
- << "\n";
- return 1;
+ if (cmHasLiteralPrefix(arg, "--source=")) {
+ sourceFile = arg.substr(9);
+ } else if (cmHasLiteralPrefix(arg, "--launcher=")) {
+ cmSystemTools::ExpandListArgument(arg.substr(11), launchers, true);
+ } else {
+ // if it was not a co-compiler or --source/--launcher then error
+ std::cerr << "__run_co_compile given unknown argument: " << arg
+ << "\n";
+ return 1;
+ }
}
} else { // if not doing_options then push to orig_cmd
orig_cmd.push_back(arg);
@@ -436,6 +439,11 @@ int cmcmd::HandleCoCompileCommands(std::vector<std::string>& args)
return 0;
}
+ // Prepend launcher argument(s), if any
+ if (!launchers.empty()) {
+ orig_cmd.insert(orig_cmd.begin(), launchers.begin(), launchers.end());
+ }
+
// Now run the real compiler command and return its result value
int ret;
if (!cmSystemTools::RunSingleCommand(orig_cmd, nullptr, nullptr, &ret,