diff options
Diffstat (limited to 'Source/cmLocalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 11b87e3..cd9af54 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -10,8 +10,10 @@ #include "cmGlobalNinjaGenerator.h" #include "cmMakefile.h" #include "cmNinjaTargetGenerator.h" +#include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" #include "cmState.h" +#include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmake.h" @@ -27,11 +29,19 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg, : cmLocalCommonGenerator(gg, mf, mf->GetState()->GetBinaryDirectory()) , HomeRelativeOutputPath("") { - this->TargetImplib = "$TARGET_IMPLIB"; } // Virtual public methods. +cmRulePlaceholderExpander* +cmLocalNinjaGenerator::CreateRulePlaceholderExpander() const +{ + cmRulePlaceholderExpander* ret = new cmRulePlaceholderExpander( + this->Compilers, this->VariableMappings, this->CompilerSysroot); + ret->SetTargetImpLib("$TARGET_IMPLIB"); + return ret; +} + cmLocalNinjaGenerator::~cmLocalNinjaGenerator() { } @@ -72,7 +82,7 @@ void cmLocalNinjaGenerator::Generate() std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets(); for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); t != targets.end(); ++t) { - if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) { + if ((*t)->GetType() == cmStateEnums::INTERFACE_LIBRARY) { continue; } cmNinjaTargetGenerator* tg = cmNinjaTargetGenerator::New(*t); @@ -120,13 +130,6 @@ cmGlobalNinjaGenerator* cmLocalNinjaGenerator::GetGlobalNinjaGenerator() // Virtual protected methods. -std::string cmLocalNinjaGenerator::ConvertToLinkReference( - std::string const& lib, cmOutputConverter::OutputFormat format) -{ - std::string path = this->GetGlobalNinjaGenerator()->ConvertToNinjaPath(lib); - return this->ConvertToOutputFormat(path, format); -} - std::string cmLocalNinjaGenerator::ConvertToIncludeReference( std::string const& path, cmOutputConverter::OutputFormat format, bool forceFullPaths) @@ -475,8 +478,8 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements() std::string cmLocalNinjaGenerator::MakeCustomLauncher( cmCustomCommandGenerator const& ccg) { - const char* property = "RULE_LAUNCH_CUSTOM"; - const char* property_value = this->Makefile->GetProperty(property); + const char* property_value = + this->Makefile->GetProperty("RULE_LAUNCH_CUSTOM"); if (!property_value || !*property_value) { return std::string(); @@ -484,25 +487,27 @@ std::string cmLocalNinjaGenerator::MakeCustomLauncher( // Expand rules in the empty string. It may insert the launcher and // perform replacements. - RuleVariables vars; - vars.RuleLauncher = property; + cmRulePlaceholderExpander::RuleVariables vars; + std::string output; const std::vector<std::string>& outputs = ccg.GetOutputs(); if (!outputs.empty()) { + output = outputs[0]; if (ccg.GetWorkingDirectory().empty()) { - output = this->ConvertToOutputFormat( - this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), - outputs[0]), - cmOutputConverter::SHELL); - } else { output = - this->ConvertToOutputFormat(outputs[0], cmOutputConverter::SHELL); + this->ConvertToRelativePath(this->GetCurrentBinaryDirectory(), output); } + output = this->ConvertToOutputFormat(output, cmOutputConverter::SHELL); } vars.Output = output.c_str(); - std::string launcher; - this->ExpandRuleVariables(launcher, vars); + std::string launcher = property_value; + launcher += " "; + + CM_AUTO_PTR<cmRulePlaceholderExpander> rulePlaceholderExpander( + this->CreateRulePlaceholderExpander()); + + rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars); if (!launcher.empty()) { launcher += " "; } |