mirror of
https://github.com/reactos/CMake.git
synced 2024-12-15 07:41:15 +00:00
cmLocalGenerator: Use strings instead of a Target in rule replacement
Don't rely on the cmGeneratorTarget type needlessly.
This commit is contained in:
parent
46ad0d2183
commit
c75a9d6601
@ -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"];
|
||||
|
@ -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;
|
||||
|
@ -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()) {
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user