diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 6dd90c85e39d4cedb019421e448e33be4a64596b..fad7fae911e2363ddf4f81275f344e4409e480da 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 7359f50fb1828b3e611b821a18ec3b835e20d502..c51aa85016437ac68ea09c2af1120102cc47c419 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 a4c73dd46759d627b2f83f4f282ffae267a8f3d6..6906cbf5a577b83940faf5cdd610bbf21feaf19c 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 92d6185c8f95ed42ac37d687c2bc8bcd5c22848d..fafff010097327a372db961be592071cae984fee 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 0566c1bf4f7adf7200d756b6d03b70ba481c7d6c..1ae34d60d080cfa4aa1d428585a5e5d251f614cc 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 77643d199708e1a521762cef7a833c62cbbeda1a..9492a61869fa4d7962860b7a600b5f96496e8bc6 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 154f3c30a5f53d55aaf2a669468020051067de73..3adc0687b3e56e013ec7b86396dfbb35d959e2c7 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 8ae055fb18c3d0273aef79bac81c59083cd19ae3..c718ad4bf07b2727b30c403a193f3fd5e8480132 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";