summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-10-09 08:34:50 (GMT)
committerStephen Kelly <steveire@gmail.com>2016-10-15 09:25:12 (GMT)
commitc75a9d660169ddd1e7be57486d3813ca73886b55 (patch)
tree7860793701f600ac504ebf7c104824ebd09aa3b2
parent46ad0d2183230d1af93242efbdcce20d55514efb (diff)
downloadCMake-c75a9d660169ddd1e7be57486d3813ca73886b55.zip
CMake-c75a9d660169ddd1e7be57486d3813ca73886b55.tar.gz
CMake-c75a9d660169ddd1e7be57486d3813ca73886b55.tar.bz2
cmLocalGenerator: Use strings instead of a Target in rule replacement
Don't rely on the cmGeneratorTarget type needlessly.
-rw-r--r--Source/cmLocalGenerator.cxx10
-rw-r--r--Source/cmLocalGenerator.h3
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx3
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx4
-rw-r--r--Source/cmMakefileTargetGenerator.cxx4
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx5
-rw-r--r--Source/cmNinjaTargetGenerator.cxx7
8 files changed, 28 insertions, 12 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 6dd90c8..fad7fae 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -724,12 +724,14 @@ std::string cmLocalGenerator::ExpandRuleVariable(
return replaceValues.Language;
}
}
- if (replaceValues.CMTarget) {
+ if (replaceValues.CMTargetName) {
if (variable == "TARGET_NAME") {
- return replaceValues.CMTarget->GetName();
+ return replaceValues.CMTargetName;
}
+ }
+ if (replaceValues.CMTargetType) {
if (variable == "TARGET_TYPE") {
- return cmState::GetTargetTypeName(replaceValues.CMTarget->GetType());
+ return replaceValues.CMTargetType;
}
}
if (replaceValues.Output) {
@@ -747,7 +749,7 @@ std::string cmLocalGenerator::ExpandRuleVariable(
this->Compilers.find(variable);
if (compIt != this->Compilers.end()) {
- std::string ret = this->ConvertToOutputForExisting(
+ std::string ret = outputConverter->ConvertToOutputForExisting(
this->VariableMappings["CMAKE_" + compIt->second + "_COMPILER"]);
std::string const& compilerArg1 =
this->VariableMappings[compIt->first + "_COMPILER_ARG1"];
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 7359f50..c51aa85 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -222,7 +222,8 @@ public:
struct RuleVariables
{
RuleVariables() { memset(this, 0, sizeof(*this)); }
- cmGeneratorTarget* CMTarget;
+ const char* CMTargetName;
+ const char* CMTargetType;
const char* TargetPDB;
const char* TargetCompilePDB;
const char* TargetVersionMajor;
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index a4c73dd..6906cbf 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -989,7 +989,8 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
// Expand rules in the empty string. It may insert the launcher and
// perform replacements.
RuleVariables vars;
- vars.CMTarget = target;
+ vars.CMTargetName = target->GetName().c_str();
+ vars.CMTargetType = cmState::GetTargetTypeName(target->GetType());
std::string output;
const std::vector<std::string>& outputs = ccg.GetOutputs();
if (!outputs.empty()) {
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 92d6185..fafff01 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -332,7 +332,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string manifests = this->GetManifests();
cmLocalGenerator::RuleVariables vars;
- vars.CMTarget = this->GeneratorTarget;
+ vars.CMTargetName = this->GeneratorTarget->GetName().c_str();
+ vars.CMTargetType =
+ cmState::GetTargetTypeName(this->GeneratorTarget->GetType());
vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 0566c1b..1ae34d6 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -540,7 +540,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
vars.TargetVersionMajor = targetVersionMajor.c_str();
vars.TargetVersionMinor = targetVersionMinor.c_str();
- vars.CMTarget = this->GeneratorTarget;
+ vars.CMTargetName = this->GeneratorTarget->GetName().c_str();
+ vars.CMTargetType =
+ cmState::GetTargetTypeName(this->GeneratorTarget->GetType());
vars.Language = linkLanguage.c_str();
vars.Objects = buildObjs.c_str();
std::string objectDir = this->GeneratorTarget->GetSupportDirectory();
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 77643d1..9492a61 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -545,7 +545,9 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
}
cmLocalGenerator::RuleVariables vars;
vars.RuleLauncher = "RULE_LAUNCH_COMPILE";
- vars.CMTarget = this->GeneratorTarget;
+ vars.CMTargetName = this->GeneratorTarget->GetName().c_str();
+ vars.CMTargetType =
+ cmState::GetTargetTypeName(this->GeneratorTarget->GetType());
vars.Language = lang.c_str();
vars.Target = targetOutPathReal.c_str();
vars.TargetPDB = targetOutPathPDB.c_str();
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 154f3c3..3adc068 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -168,7 +168,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile)
if (!this->GetGlobalGenerator()->HasRule(ruleName)) {
cmLocalGenerator::RuleVariables vars;
- vars.CMTarget = this->GetGeneratorTarget();
+ vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str();
+ vars.CMTargetType =
+ cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType());
+
vars.Language = this->TargetLinkLanguage.c_str();
std::string responseFlag;
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 8ae055f..c718ad4 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -374,7 +374,9 @@ void cmNinjaTargetGenerator::WriteLanguageRules(const std::string& language)
void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
{
cmLocalGenerator::RuleVariables vars;
- vars.CMTarget = this->GetGeneratorTarget();
+ vars.CMTargetName = this->GetGeneratorTarget()->GetName().c_str();
+ vars.CMTargetType =
+ cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType());
vars.Language = lang.c_str();
vars.Source = "$IN_ABS";
vars.Object = "$out";
@@ -474,7 +476,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
std::string const ppDepfile = "$DEP_FILE";
cmLocalGenerator::RuleVariables ppVars;
- ppVars.CMTarget = vars.CMTarget;
+ ppVars.CMTargetName = vars.CMTargetName;
+ ppVars.CMTargetType = vars.CMTargetType;
ppVars.Language = vars.Language;
ppVars.Object = "$out"; // for RULE_LAUNCH_COMPILE
ppVars.PreprocessedSource = "$out";