diff options
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 = |