summaryrefslogtreecommitdiff
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-10-09 10:34:50 +0200
committerStephen Kelly <steveire@gmail.com>2016-10-15 11:25:12 +0200
commitb59b6dd9d27de7839c7b23a3094db33298038896 (patch)
tree2b36fbb568918ef952f0f59beaa15363f09b400f /Source/cmNinjaTargetGenerator.cxx
parentbdddd4234e977f65ee7df8adcd3888706dfd0dda (diff)
downloadcmake-b59b6dd9d27de7839c7b23a3094db33298038896.tar.gz
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.cxx25
1 files changed, 16 insertions, 9 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index c718ad4bf0..1ac6cd41d1 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 =