summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-05-22 13:30:38 (GMT)
committerBrad King <brad.king@kitware.com>2019-05-22 14:47:15 (GMT)
commit8ee6584a9975e766047fd73815a81a8d9c7db3f5 (patch)
tree8d76c7cac918f338f739422b5377ef67c60565b4
parentf01e18eb4699df530e310d376e66752fa6c1dedf (diff)
downloadCMake-8ee6584a9975e766047fd73815a81a8d9c7db3f5.zip
CMake-8ee6584a9975e766047fd73815a81a8d9c7db3f5.tar.gz
CMake-8ee6584a9975e766047fd73815a81a8d9c7db3f5.tar.bz2
Ninja,Makefile: Fix <LANG>_COMPILER_LAUNCHER shell command syntax
The first entry in the compiler launcher command argument list is the command itself and should be converted to the shell's native command syntax (e.g. backslashes on Windows). Without this, the `RunCMake.CompilerLauncher` test fails on Windows when there are *no* spaces in the path to `cmake.exe`.
-rw-r--r--Source/cmMakefileTargetGenerator.cxx8
-rw-r--r--Source/cmNinjaTargetGenerator.cxx9
2 files changed, 13 insertions, 4 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 3a89d75..d326ec5 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -788,8 +788,12 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
if (!compileCommands.empty() && !compilerLauncher.empty()) {
std::vector<std::string> args;
cmSystemTools::ExpandListArgument(compilerLauncher, args, true);
- for (std::string& i : args) {
- i = this->LocalGenerator->EscapeForShell(i);
+ if (!args.empty()) {
+ args[0] = this->LocalGenerator->ConvertToOutputFormat(
+ args[0], cmOutputConverter::SHELL);
+ for (std::string& i : cmMakeRange(args.begin() + 1, args.end())) {
+ i = this->LocalGenerator->EscapeForShell(i);
+ }
}
compileCommands.front().insert(0, cmJoin(args, " ") + " ");
}
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 9deaa13..e6a13bb 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -25,6 +25,7 @@
#include "cmNinjaNormalTargetGenerator.h"
#include "cmNinjaUtilityTargetGenerator.h"
#include "cmOutputConverter.h"
+#include "cmRange.h"
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
@@ -763,8 +764,12 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
if (!compileCmds.empty() && !compilerLauncher.empty()) {
std::vector<std::string> args;
cmSystemTools::ExpandListArgument(compilerLauncher, args, true);
- for (std::string& i : args) {
- i = this->LocalGenerator->EscapeForShell(i);
+ if (!args.empty()) {
+ args[0] = this->LocalGenerator->ConvertToOutputFormat(
+ args[0], cmOutputConverter::SHELL);
+ for (std::string& i : cmMakeRange(args.begin() + 1, args.end())) {
+ i = this->LocalGenerator->EscapeForShell(i);
+ }
}
compileCmds.front().insert(0, cmJoin(args, " ") + " ");
}