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 | 88016e2e9f13d60c4a0b88fb64ffd802a2d9e534 (patch) | |
tree | 4e0a6852454140b1c874c9b7de318bf3f7532848 /Source | |
parent | be87cb0c444595fa1970e257031252669c201d3e (diff) | |
download | CMake-88016e2e9f13d60c4a0b88fb64ffd802a2d9e534.zip CMake-88016e2e9f13d60c4a0b88fb64ffd802a2d9e534.tar.gz CMake-88016e2e9f13d60c4a0b88fb64ffd802a2d9e534.tar.bz2 |
cmLocalGenerator: Introduce a container of compiler names
Use it to determine when a rule replacement should gain extra options.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4f285cf..a9de948 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -691,6 +691,17 @@ std::string cmLocalGenerator::ExpandRuleVariable( } std::vector<std::string> enabledLanguages = this->GetState()->GetEnabledLanguages(); + + std::map<std::string, std::string> compilers; + for (std::vector<std::string>::iterator i = enabledLanguages.begin(); + i != enabledLanguages.end(); ++i) { + std::string const& lang = *i; + if (lang == "NONE") { + continue; + } + compilers["CMAKE_" + lang + "_COMPILER"] = lang; + } + // loop over language specific replace variables for (const char* const* replaceIter = cmArrayBegin(ruleReplaceVars); replaceIter != cmArrayEnd(ruleReplaceVars); ++replaceIter) { @@ -707,9 +718,12 @@ std::string cmLocalGenerator::ExpandRuleVariable( const char* compilerOptionExternalToolchain = CM_NULLPTR; const char* compilerSysroot = CM_NULLPTR; const char* compilerOptionSysroot = CM_NULLPTR; - if (actualReplace == "CMAKE_${LANG}_COMPILER") { - std::string arg1 = actualReplace + "_ARG1"; - cmSystemTools::ReplaceString(arg1, "${LANG}", lang); + + std::map<std::string, std::string>::iterator compIt = + compilers.find(variable); + + if (compIt != compilers.end()) { + std::string arg1 = compIt->first + "_ARG1"; compilerArg1 = this->Makefile->GetDefinition(arg1); compilerTarget = this->Makefile->GetDefinition( std::string("CMAKE_") + lang + "_COMPILER_TARGET"); |