diff options
author | Brad King <brad.king@kitware.com> | 2019-05-23 12:53:57 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-05-23 13:01:04 (GMT) |
commit | 4f739a4e47d450406818804e45e5daaf452b39a8 (patch) | |
tree | 95530cdebb1b809bf2a00e420646f98d3a1f1c91 | |
parent | 5222400d9f574b5f953a2fe1d2c95a9754c683f3 (diff) | |
parent | 8ee6584a9975e766047fd73815a81a8d9c7db3f5 (diff) | |
download | CMake-4f739a4e47d450406818804e45e5daaf452b39a8.zip CMake-4f739a4e47d450406818804e45e5daaf452b39a8.tar.gz CMake-4f739a4e47d450406818804e45e5daaf452b39a8.tar.bz2 |
Merge topic 'compiler-launcher-shell-format'
8ee6584a99 Ninja,Makefile: Fix <LANG>_COMPILER_LAUNCHER shell command syntax
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3361
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 9 |
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, " ") + " "); } |