diff options
author | Brad King <brad.king@kitware.com> | 2021-01-11 16:05:43 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-01-28 17:47:57 (GMT) |
commit | 121509250734f420cd48a64e171ba155ade3cd59 (patch) | |
tree | c42b5b7a89413448f2d736fc10579abd98fe028c /Source | |
parent | 2452cfdeab0a4c07a84b0908f4d4ecee79861ec8 (diff) | |
download | CMake-121509250734f420cd48a64e171ba155ade3cd59.zip CMake-121509250734f420cd48a64e171ba155ade3cd59.tar.gz CMake-121509250734f420cd48a64e171ba155ade3cd59.tar.bz2 |
cmInstallScriptGenerator: Factor out method to get script
Diffstat (limited to 'Source')
-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 5b01791..80b7860 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 f7ee3f9..6f0c837 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, |