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/cmNinjaTargetGenerator.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/cmNinjaTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaTargetGenerator.cxx | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index c718ad4..1ac6cd4 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -14,6 +14,7 @@ #include "cmNinjaNormalTargetGenerator.h" #include "cmNinjaUtilityTargetGenerator.h" #include "cmOutputConverter.h" +#include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" #include "cmState.h" #include "cmSystemTools.h" @@ -373,7 +374,7 @@ void cmNinjaTargetGenerator::WriteLanguageRules(const std::string& language) void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) { - cmLocalGenerator::RuleVariables vars; + cmRulePlaceholderExpander::RuleVariables vars; vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str(); vars.CMTargetType = cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType()); @@ -453,6 +454,9 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) vars.Flags = flags.c_str(); vars.DependencyFile = depfile.c_str(); + CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander( + this->GetLocalGenerator()->CreateRulePlaceholderExpander()); + std::string const tdi = this->GetLocalGenerator()->ConvertToOutputFormat( ConvertToNinjaPath(this->GetTargetDependInfoPath(lang)), cmLocalGenerator::SHELL); @@ -475,7 +479,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) std::string const ppDeptype = ""; // no deps= for multiple outputs std::string const ppDepfile = "$DEP_FILE"; - cmLocalGenerator::RuleVariables ppVars; + cmRulePlaceholderExpander::RuleVariables ppVars; ppVars.CMTargetName = vars.CMTargetName; ppVars.CMTargetType = vars.CMTargetType; ppVars.Language = vars.Language; @@ -506,8 +510,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) for (std::vector<std::string>::iterator i = ppCmds.begin(); i != ppCmds.end(); ++i) { *i = launcher + *i; - this->GetLocalGenerator()->ExpandRuleVariables(this->GetLocalGenerator(), - *i, ppVars); + rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), + *i, ppVars); } // Run CMake dependency scanner on preprocessed output. @@ -620,8 +624,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang) for (std::vector<std::string>::iterator i = compileCmds.begin(); i != compileCmds.end(); ++i) { *i = launcher + *i; - this->GetLocalGenerator()->ExpandRuleVariables(this->GetLocalGenerator(), - *i, vars); + rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), *i, + vars); } std::string cmdLine = @@ -974,7 +978,7 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( return; } - cmLocalGenerator::RuleVariables compileObjectVars; + cmRulePlaceholderExpander::RuleVariables compileObjectVars; compileObjectVars.Language = language.c_str(); std::string escapedSourceFileName = sourceFileName; @@ -1006,10 +1010,13 @@ void cmNinjaTargetGenerator::ExportObjectCompileCommand( std::vector<std::string> compileCmds; cmSystemTools::ExpandListArgument(compileCmd, compileCmds); + CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander( + this->GetLocalGenerator()->CreateRulePlaceholderExpander()); + for (std::vector<std::string>::iterator i = compileCmds.begin(); i != compileCmds.end(); ++i) { - this->GetLocalGenerator()->ExpandRuleVariables(this->GetLocalGenerator(), - *i, compileObjectVars); + rulePlaceholderExpander->ExpandRuleVariables(this->GetLocalGenerator(), *i, + compileObjectVars); } std::string cmdLine = |