diff options
author | Stephen Kelly <steveire@gmail.com> | 2016-10-09 08:34:48 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2016-10-15 09:25:12 (GMT) |
commit | f009d8f5e2e4007b93494c5d22ba25b41a4872a1 (patch) | |
tree | 1dedf285d2104498468da794f018048e6e2278d0 /Source/cmLocalGenerator.cxx | |
parent | 6cd27a853a1c77e5da0a9a14140284a7674cf18c (diff) | |
download | CMake-f009d8f5e2e4007b93494c5d22ba25b41a4872a1.zip CMake-f009d8f5e2e4007b93494c5d22ba25b41a4872a1.tar.gz CMake-f009d8f5e2e4007b93494c5d22ba25b41a4872a1.tar.bz2 |
cmLocalGenerator: Move compiler option handling to be more direct
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 03f5d2c..d451270 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -740,6 +740,30 @@ std::string cmLocalGenerator::ExpandRuleVariable( compilerSysroot = this->Makefile->GetDefinition("CMAKE_SYSROOT"); compilerOptionSysroot = this->Makefile->GetDefinition( std::string("CMAKE_") + compIt->second + "_COMPILE_OPTIONS_SYSROOT"); + + std::string ret = this->ConvertToOutputForExisting(replace); + // if there is a required first argument to the compiler add it + // to the compiler string + if (compilerArg1) { + ret += " "; + ret += compilerArg1; + } + if (compilerTarget && compilerOptionTarget) { + ret += " "; + ret += compilerOptionTarget; + ret += compilerTarget; + } + if (compilerExternalToolchain && compilerOptionExternalToolchain) { + ret += " "; + ret += compilerOptionExternalToolchain; + ret += this->EscapeForShell(compilerExternalToolchain, true); + } + if (compilerSysroot && compilerOptionSysroot) { + ret += " "; + ret += compilerOptionSysroot; + ret += this->EscapeForShell(compilerSysroot, true); + } + return ret; } if (actualReplace.find("${LANG}") != actualReplace.npos) { cmSystemTools::ReplaceString(actualReplace, "${LANG}", lang); @@ -747,29 +771,7 @@ std::string cmLocalGenerator::ExpandRuleVariable( if (actualReplace == variable) { // if the variable is not a FLAG then treat it like a path if (variable.find("_FLAG") == variable.npos) { - std::string ret = this->ConvertToOutputForExisting(replace); - // if there is a required first argument to the compiler add it - // to the compiler string - if (compilerArg1) { - ret += " "; - ret += compilerArg1; - } - if (compilerTarget && compilerOptionTarget) { - ret += " "; - ret += compilerOptionTarget; - ret += compilerTarget; - } - if (compilerExternalToolchain && compilerOptionExternalToolchain) { - ret += " "; - ret += compilerOptionExternalToolchain; - ret += this->EscapeForShell(compilerExternalToolchain, true); - } - if (compilerSysroot && compilerOptionSysroot) { - ret += " "; - ret += compilerOptionSysroot; - ret += this->EscapeForShell(compilerSysroot, true); - } - return ret; + return this->ConvertToOutputForExisting(replace); } return replace; } |