summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-10-09 08:34:50 (GMT)
committerStephen Kelly <steveire@gmail.com>2016-10-15 09:25:12 (GMT)
commit46ad0d2183230d1af93242efbdcce20d55514efb (patch)
treed850f9a4d42df6e5bc39c8d01234051fd6ca7f29 /Source/cmLocalGenerator.cxx
parent2628dec12cb22546d2a21032f53fb0ef096faec8 (diff)
downloadCMake-46ad0d2183230d1af93242efbdcce20d55514efb.zip
CMake-46ad0d2183230d1af93242efbdcce20d55514efb.tar.gz
CMake-46ad0d2183230d1af93242efbdcce20d55514efb.tar.bz2
cmLocalGenerator: Use a converter in rule replacement API
The rule replacement API should not really be in cmLocalGenerator, but it was historically, and this coupled many other things together here too, such as output conversion. Make the output converter a parameter so that rule replacement can be removed from cmLocalGenerator.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 42e4b63..6dd90c8 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -561,7 +561,8 @@ cmState::Snapshot cmLocalGenerator::GetStateSnapshot() const
}
std::string cmLocalGenerator::ExpandRuleVariable(
- std::string const& variable, const RuleVariables& replaceValues)
+ cmOutputConverter* outputConverter, std::string const& variable,
+ const RuleVariables& replaceValues)
{
if (replaceValues.LinkFlags) {
if (variable == "LINK_FLAGS") {
@@ -737,7 +738,7 @@ std::string cmLocalGenerator::ExpandRuleVariable(
}
}
if (variable == "CMAKE_COMMAND") {
- return this->ConvertToOutputFormat(
+ return outputConverter->ConvertToOutputFormat(
cmSystemTools::CollapseFullPath(cmSystemTools::GetCMakeCommand()),
SHELL);
}
@@ -780,12 +781,12 @@ std::string cmLocalGenerator::ExpandRuleVariable(
!compilerOptionExternalToolchain.empty()) {
ret += " ";
ret += compilerOptionExternalToolchain;
- ret += this->EscapeForShell(compilerExternalToolchain, true);
+ ret += outputConverter->EscapeForShell(compilerExternalToolchain, true);
}
if (!this->CompilerSysroot.empty() && !compilerOptionSysroot.empty()) {
ret += " ";
ret += compilerOptionSysroot;
- ret += this->EscapeForShell(this->CompilerSysroot, true);
+ ret += outputConverter->EscapeForShell(this->CompilerSysroot, true);
}
return ret;
}
@@ -794,14 +795,15 @@ std::string cmLocalGenerator::ExpandRuleVariable(
this->VariableMappings.find(variable);
if (mapIt != this->VariableMappings.end()) {
if (variable.find("_FLAG") == variable.npos) {
- return this->ConvertToOutputForExisting(mapIt->second);
+ return outputConverter->ConvertToOutputForExisting(mapIt->second);
}
return mapIt->second;
}
return variable;
}
-void cmLocalGenerator::ExpandRuleVariables(std::string& s,
+void cmLocalGenerator::ExpandRuleVariables(cmOutputConverter* outputConverter,
+ std::string& s,
const RuleVariables& replaceValues)
{
std::string::size_type start = s.find('<');
@@ -825,7 +827,8 @@ void cmLocalGenerator::ExpandRuleVariables(std::string& s,
} else {
// extract the var
std::string var = s.substr(start + 1, end - start - 1);
- std::string replace = this->ExpandRuleVariable(var, replaceValues);
+ std::string replace =
+ this->ExpandRuleVariable(outputConverter, var, replaceValues);
expandedInput += s.substr(pos, start - pos);
expandedInput += replace;
// move to next one