cmLocalGenerator::GetRuleLauncher: return cmProp

This commit is contained in:
vvs31415 2020-11-02 09:00:00 -05:00
parent 91e826fd75
commit f808f27919
8 changed files with 29 additions and 31 deletions

View File

@ -823,16 +823,13 @@ cmStateSnapshot cmLocalGenerator::GetStateSnapshot() const
return this->Makefile->GetStateSnapshot();
}
const char* cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
const std::string& prop)
cmProp cmLocalGenerator::GetRuleLauncher(cmGeneratorTarget* target,
const std::string& prop)
{
cmProp p;
if (target) {
p = target->GetProperty(prop);
} else {
p = this->Makefile->GetProperty(prop);
return target->GetProperty(prop);
}
return p ? p->c_str() : nullptr;
return this->Makefile->GetProperty(prop);
}
std::string cmLocalGenerator::ConvertToIncludeReference(

View File

@ -519,8 +519,7 @@ public:
void CreateEvaluationFileOutputs(const std::string& config);
void ProcessEvaluationFiles(std::vector<std::string>& generatedFiles);
const char* GetRuleLauncher(cmGeneratorTarget* target,
const std::string& prop);
cmProp GetRuleLauncher(cmGeneratorTarget* target, const std::string& prop);
protected:
//! put all the libraries for a target on into the given stream

View File

@ -960,7 +960,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
std::string launcher;
// Short-circuit if there is no launcher.
const char* val = this->GetRuleLauncher(target, "RULE_LAUNCH_CUSTOM");
cmProp val = this->GetRuleLauncher(target, "RULE_LAUNCH_CUSTOM");
if (cmNonempty(val)) {
// Expand rule variables referenced in the given launcher command.
cmRulePlaceholderExpander::RuleVariables vars;
@ -980,7 +980,7 @@ void cmLocalUnixMakefileGenerator3::AppendCustomCommand(
}
vars.Output = output.c_str();
launcher = val;
launcher = *val;
rulePlaceholderExpander->ExpandRuleVariables(this, launcher, vars);
if (!launcher.empty()) {
launcher += " ";

View File

@ -21,6 +21,7 @@
#include "cmMakefile.h"
#include "cmOSXBundleGenerator.h"
#include "cmOutputConverter.h"
#include "cmProperty.h"
#include "cmRulePlaceholderExpander.h"
#include "cmState.h"
#include "cmStateDirectory.h"
@ -232,10 +233,10 @@ void cmMakefileExecutableTargetGenerator::WriteNvidiaDeviceExecutableRule(
std::string launcher;
const char* val = this->LocalGenerator->GetRuleLauncher(
this->GeneratorTarget, "RULE_LAUNCH_LINK");
cmProp val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget,
"RULE_LAUNCH_LINK");
if (cmNonempty(val)) {
launcher = cmStrCat(val, ' ');
launcher = cmStrCat(*val, ' ');
}
std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
@ -591,10 +592,10 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string launcher;
const char* val = this->LocalGenerator->GetRuleLauncher(
this->GeneratorTarget, "RULE_LAUNCH_LINK");
cmProp val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget,
"RULE_LAUNCH_LINK");
if (cmNonempty(val)) {
launcher = cmStrCat(val, ' ');
launcher = cmStrCat(*val, ' ');
}
std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(

View File

@ -21,6 +21,7 @@
#include "cmMakefile.h"
#include "cmOSXBundleGenerator.h"
#include "cmOutputConverter.h"
#include "cmProperty.h"
#include "cmRulePlaceholderExpander.h"
#include "cmState.h"
#include "cmStateDirectory.h"
@ -366,10 +367,10 @@ void cmMakefileLibraryTargetGenerator::WriteNvidiaDeviceLibraryRules(
vars.TargetCompilePDB = targetOutPathCompilePDB.c_str();
std::string launcher;
const char* val = this->LocalGenerator->GetRuleLauncher(
this->GeneratorTarget, "RULE_LAUNCH_LINK");
cmProp val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget,
"RULE_LAUNCH_LINK");
if (cmNonempty(val)) {
launcher = cmStrCat(val, ' ');
launcher = cmStrCat(*val, ' ');
}
std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
@ -816,10 +817,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
vars.LanguageCompileFlags = langFlags.c_str();
std::string launcher;
const char* val = this->LocalGenerator->GetRuleLauncher(
this->GeneratorTarget, "RULE_LAUNCH_LINK");
cmProp val = this->LocalGenerator->GetRuleLauncher(this->GeneratorTarget,
"RULE_LAUNCH_LINK");
if (cmNonempty(val)) {
launcher = cmStrCat(val, ' ');
launcher = cmStrCat(*val, ' ');
}
std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(

View File

@ -943,10 +943,10 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string launcher;
{
const char* val = this->LocalGenerator->GetRuleLauncher(
cmProp val = this->LocalGenerator->GetRuleLauncher(
this->GeneratorTarget, "RULE_LAUNCH_COMPILE");
if (cmNonempty(val)) {
launcher = cmStrCat(val, ' ');
launcher = cmStrCat(*val, ' ');
}
}

View File

@ -266,10 +266,10 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkRule(
vars.LanguageCompileFlags = "$LANGUAGE_COMPILE_FLAGS";
std::string launcher;
const char* val = this->GetLocalGenerator()->GetRuleLauncher(
cmProp val = this->GetLocalGenerator()->GetRuleLauncher(
this->GetGeneratorTarget(), "RULE_LAUNCH_LINK");
if (cmNonempty(val)) {
launcher = cmStrCat(val, ' ');
launcher = cmStrCat(*val, ' ');
}
std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(
@ -452,10 +452,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(bool useResponseFile,
}
std::string launcher;
const char* val = this->GetLocalGenerator()->GetRuleLauncher(
cmProp val = this->GetLocalGenerator()->GetRuleLauncher(
this->GetGeneratorTarget(), "RULE_LAUNCH_LINK");
if (cmNonempty(val)) {
launcher = cmStrCat(val, ' ');
launcher = cmStrCat(*val, ' ');
}
std::unique_ptr<cmRulePlaceholderExpander> rulePlaceholderExpander(

View File

@ -664,10 +664,10 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
cmLocalGenerator::SHELL);
std::string launcher;
const char* val = this->GetLocalGenerator()->GetRuleLauncher(
cmProp val = this->GetLocalGenerator()->GetRuleLauncher(
this->GetGeneratorTarget(), "RULE_LAUNCH_COMPILE");
if (cmNonempty(val)) {
launcher = cmStrCat(val, ' ');
launcher = cmStrCat(*val, ' ');
}
std::string const cmakeCmd =