diff options
author | Brad King <brad.king@kitware.com> | 2021-01-11 11:05:43 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-01-28 12:47:57 -0500 |
commit | 121509250734f420cd48a64e171ba155ade3cd59 (patch) | |
tree | c42b5b7a89413448f2d736fc10579abd98fe028c | |
parent | 2452cfdeab0a4c07a84b0908f4d4ecee79861ec8 (diff) | |
download | cmake-121509250734f420cd48a64e171ba155ade3cd59.tar.gz |
cmInstallScriptGenerator: Factor out method to get script
-rw-r--r-- | Source/cmInstallScriptGenerator.cxx | 21 | ||||
-rw-r--r-- | Source/cmInstallScriptGenerator.h | 4 |
2 files changed, 18 insertions, 7 deletions
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index 5b017914af..80b78607c0 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -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)); } diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index f7ee3f9a15..6f0c837585 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -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, |