summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-10-09 08:34:49 (GMT)
committerStephen Kelly <steveire@gmail.com>2016-10-15 09:25:12 (GMT)
commitd5feb5b34cd9f595bf42aa934738b918785e3e87 (patch)
tree80a78eca99a00b2f3654297ed6484d27d01aebe1 /Source/cmLocalGenerator.cxx
parentefba22e1deebcfc3924d5f14c026104eb4b62d28 (diff)
downloadCMake-d5feb5b34cd9f595bf42aa934738b918785e3e87.zip
CMake-d5feb5b34cd9f595bf42aa934738b918785e3e87.tar.gz
CMake-d5feb5b34cd9f595bf42aa934738b918785e3e87.tar.bz2
cmLocalGenerator: Populate variable mapping for all replacements
This reduces the final replacement to a simple query in the map, which is much more readable than what was here before.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx21
1 files changed, 11 insertions, 10 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 0cf2e54..3957641 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -738,8 +738,6 @@ std::string cmLocalGenerator::ExpandRuleVariable(
std::map<std::string, std::string>::iterator compIt =
compilers.find(variable);
- std::string replace = this->Makefile->GetSafeDefinition(variable);
-
if (compIt != compilers.end()) {
std::string ret = this->ConvertToOutputForExisting(
variableMappings["CMAKE_" + compIt->second + "_COMPILER"]);
@@ -783,7 +781,6 @@ std::string cmLocalGenerator::ExpandRuleVariable(
return ret;
}
- // loop over language specific replace variables
for (const char* const* replaceIter = cmArrayBegin(ruleReplaceVars);
replaceIter != cmArrayEnd(ruleReplaceVars); ++replaceIter) {
for (std::vector<std::string>::iterator i = enabledLanguages.begin();
@@ -793,14 +790,18 @@ std::string cmLocalGenerator::ExpandRuleVariable(
if (actualReplace.find("${LANG}") != actualReplace.npos) {
cmSystemTools::ReplaceString(actualReplace, "${LANG}", lang);
}
- if (actualReplace == variable) {
- // if the variable is not a FLAG then treat it like a path
- if (variable.find("_FLAG") == variable.npos) {
- return this->ConvertToOutputForExisting(replace);
- }
- return replace;
- }
+
+ variableMappings[actualReplace] =
+ this->Makefile->GetSafeDefinition(actualReplace);
+ }
+ }
+ std::map<std::string, std::string>::iterator mapIt =
+ variableMappings.find(variable);
+ if (mapIt != variableMappings.end()) {
+ if (variable.find("_FLAG") == variable.npos) {
+ return this->ConvertToOutputForExisting(mapIt->second);
}
+ return mapIt->second;
}
return variable;
}