diff options
author | Bobby D Reynolds <boreynol@microsoft.com> | 2021-05-18 15:57:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-05-28 16:28:43 (GMT) |
commit | ae108418ae45aff7740605bb7add3843b050d226 (patch) | |
tree | 1b46b02e2c567538b0437fed2aef91564cd8f577 /Source/cmRulePlaceholderExpander.cxx | |
parent | 92c8b83641eae61700d16602e0b60d9c9c6f3b15 (diff) | |
download | CMake-ae108418ae45aff7740605bb7add3843b050d226.zip CMake-ae108418ae45aff7740605bb7add3843b050d226.tar.gz CMake-ae108418ae45aff7740605bb7add3843b050d226.tar.bz2 |
Launchers: Support setting linker launchers
Fixes: #18316
Diffstat (limited to 'Source/cmRulePlaceholderExpander.cxx')
-rw-r--r-- | Source/cmRulePlaceholderExpander.cxx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Source/cmRulePlaceholderExpander.cxx b/Source/cmRulePlaceholderExpander.cxx index d00bbdf..7480aeb 100644 --- a/Source/cmRulePlaceholderExpander.cxx +++ b/Source/cmRulePlaceholderExpander.cxx @@ -6,6 +6,7 @@ #include <utility> #include "cmOutputConverter.h" +#include "cmStringAlgorithms.h" #include "cmSystemTools.h" cmRulePlaceholderExpander::cmRulePlaceholderExpander( @@ -280,6 +281,13 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable( this->VariableMappings["CMAKE_" + compIt->second + "_COMPILE_OPTIONS_SYSROOT"]; + if (compIt->second == replaceValues.Language && replaceValues.Launcher) { + // Add launcher as part of expansion so that it always appears + // immediately before the command itself, regardless of whether the + // overall rule template contains other content at the front. + ret = cmStrCat(replaceValues.Launcher, " ", ret); + } + // if there are required arguments to the compiler add it // to the compiler string if (!compilerArg1.empty()) { @@ -317,7 +325,17 @@ std::string cmRulePlaceholderExpander::ExpandRuleVariable( auto mapIt = this->VariableMappings.find(variable); if (mapIt != this->VariableMappings.end()) { if (variable.find("_FLAG") == std::string::npos) { - return outputConverter->ConvertToOutputForExisting(mapIt->second); + std::string ret = + outputConverter->ConvertToOutputForExisting(mapIt->second); + + if (replaceValues.Launcher && variable == "CMAKE_LINKER") { + // Add launcher as part of expansion so that it always appears + // immediately before the command itself, regardless of whether the + // overall rule template contains other content at the front. + ret = cmStrCat(replaceValues.Launcher, " ", ret); + } + + return ret; } return mapIt->second; } |