diff options
author | Stephen Kelly <steveire@gmail.com> | 2016-10-09 08:34:50 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2016-10-15 09:25:12 (GMT) |
commit | b59b6dd9d27de7839c7b23a3094db33298038896 (patch) | |
tree | 2b36fbb568918ef952f0f59beaa15363f09b400f /Source/cmMakefileTargetGenerator.cxx | |
parent | bdddd4234e977f65ee7df8adcd3888706dfd0dda (diff) | |
download | CMake-b59b6dd9d27de7839c7b23a3094db33298038896.zip CMake-b59b6dd9d27de7839c7b23a3094db33298038896.tar.gz CMake-b59b6dd9d27de7839c7b23a3094db33298038896.tar.bz2 |
cmRulePlaceholderExpander: Port clients to direct-use
Add a factory function to cmLocalGenerator so that variableMappings can
be provided from it, and so that Ninja can always have a hard-coded
TargetImpLib.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 9492a61..cbfe850 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -18,6 +18,7 @@ #include "cmMakefileLibraryTargetGenerator.h" #include "cmMakefileUtilityTargetGenerator.h" #include "cmOutputConverter.h" +#include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" #include "cmState.h" #include "cmSystemTools.h" @@ -543,7 +544,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( targetOutPathCompilePDB[targetOutPathCompilePDB.size() - 1] = '/'; } } - cmLocalGenerator::RuleVariables vars; + cmRulePlaceholderExpander::RuleVariables vars; vars.RuleLauncher = "RULE_LAUNCH_COMPILE"; vars.CMTargetName = this->GeneratorTarget->GetName().c_str(); vars.CMTargetType = @@ -589,6 +590,9 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( bool const lang_has_assembly = lang_has_preprocessor; bool const lang_can_export_cmds = lang_has_preprocessor; + CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander( + this->LocalGenerator->CreateRulePlaceholderExpander()); + // Construct the compile rules. { std::string compileRuleVar = "CMAKE_"; @@ -602,8 +606,9 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( if (this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS") && lang_can_export_cmds && compileCommands.size() == 1) { std::string compileCommand = compileCommands[0]; - this->LocalGenerator->ExpandRuleVariables(this->LocalGenerator, - compileCommand, vars); + + rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, + compileCommand, vars); std::string workingDirectory = cmSystemTools::CollapseFullPath( this->LocalGenerator->GetCurrentBinaryDirectory()); compileCommand.replace(compileCommand.find(langFlags), langFlags.size(), @@ -662,8 +667,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( // Expand placeholders in the commands. for (std::vector<std::string>::iterator i = compileCommands.begin(); i != compileCommands.end(); ++i) { - this->LocalGenerator->ExpandRuleVariables(this->LocalGenerator, *i, - vars); + rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, *i, + vars); } // Change the command working directory to the local build tree. @@ -726,8 +731,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( // Expand placeholders in the commands. for (std::vector<std::string>::iterator i = preprocessCommands.begin(); i != preprocessCommands.end(); ++i) { - this->LocalGenerator->ExpandRuleVariables(this->LocalGenerator, *i, - vars); + rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, + *i, vars); } this->LocalGenerator->CreateCDCommand( @@ -774,8 +779,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile( // Expand placeholders in the commands. for (std::vector<std::string>::iterator i = assemblyCommands.begin(); i != assemblyCommands.end(); ++i) { - this->LocalGenerator->ExpandRuleVariables(this->LocalGenerator, *i, - vars); + rulePlaceholderExpander->ExpandRuleVariables(this->LocalGenerator, + *i, vars); } this->LocalGenerator->CreateCDCommand( |