cmInstallScriptGenerator: Factor out method to get script

This commit is contained in:
Brad King
2021-01-11 11:05:43 -05:00
parent 2452cfdeab
commit 1215092507
2 changed files with 18 additions and 7 deletions

View File

@@ -53,6 +53,19 @@ bool cmInstallScriptGenerator::Compute(cmLocalGenerator* lg)
return true;
}
std::string cmInstallScriptGenerator::GetScript(
std::string const& config) const
{
std::string script;
if (this->AllowGenex && this->ActionsPerConfig) {
script = cmGeneratorExpression::Evaluate(this->Script,
this->LocalGenerator, config);
} else {
script = this->Script;
}
return script;
}
void cmInstallScriptGenerator::AddScriptInstallRule(
std::ostream& os, Indent indent, std::string const& script) const
{
@@ -76,11 +89,5 @@ void cmInstallScriptGenerator::GenerateScriptActions(std::ostream& os,
void cmInstallScriptGenerator::GenerateScriptForConfig(
std::ostream& os, const std::string& config, Indent indent)
{
if (this->AllowGenex) {
this->AddScriptInstallRule(os, indent,
cmGeneratorExpression::Evaluate(
this->Script, this->LocalGenerator, config));
} else {
this->AddScriptInstallRule(os, indent, this->Script);
}
this->AddScriptInstallRule(os, indent, this->GetScript(config));
}

View File

@@ -25,6 +25,10 @@ public:
bool Compute(cmLocalGenerator* lg) override;
bool IsCode() const { return this->Code; }
std::string GetScript(std::string const& config) const;
protected:
void GenerateScriptActions(std::ostream& os, Indent indent) override;
void GenerateScriptForConfig(std::ostream& os, const std::string& config,