diff options
author | Brad King <brad.king@kitware.com> | 2018-10-12 12:11:42 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-10-12 12:11:49 (GMT) |
commit | ced094e22e1c94da249990668d106a80faaeab57 (patch) | |
tree | fb022879e66d1aa27a2974e06d8c5862c138f16c /Source | |
parent | 02eb3c302a71210b375a6b4f9ae604c5e5dafe02 (diff) | |
parent | fd0e40f1667ed7e835d5a6fcbcf3b4d6489dff2c (diff) | |
download | CMake-ced094e22e1c94da249990668d106a80faaeab57.zip CMake-ced094e22e1c94da249990668d106a80faaeab57.tar.gz CMake-ced094e22e1c94da249990668d106a80faaeab57.tar.bz2 |
Merge topic 'revert-install-code-script-genex'
fd0e40f166 Merge branch 'backport-revert-install-code-script-genex' into revert-install-code-script-genex
0f48fbaa72 install: Revert CODE,SCRIPT support for generator expressions
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2474
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmInstallScriptGenerator.cxx | 40 | ||||
-rw-r--r-- | Source/cmInstallScriptGenerator.h | 13 |
2 files changed, 9 insertions, 44 deletions
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index 1d7784e..7d77b7c 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -2,7 +2,6 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmInstallScriptGenerator.h" -#include "cmGeneratorExpression.h" #include "cmScriptGenerator.h" #include <ostream> @@ -17,47 +16,24 @@ cmInstallScriptGenerator::cmInstallScriptGenerator(const char* script, , Script(script) , Code(code) { - // We need per-config actions if the script has generator expressions. - if (cmGeneratorExpression::Find(Script) != std::string::npos) { - this->ActionsPerConfig = true; - } } cmInstallScriptGenerator::~cmInstallScriptGenerator() { } -void cmInstallScriptGenerator::Compute(cmLocalGenerator* lg) +void cmInstallScriptGenerator::GenerateScript(std::ostream& os) { - this->LocalGenerator = lg; -} + Indent indent; + std::string component_test = + this->CreateComponentTest(this->Component.c_str(), this->ExcludeFromAll); + os << indent << "if(" << component_test << ")\n"; -void cmInstallScriptGenerator::AddScriptInstallRule(std::ostream& os, - Indent indent, - std::string const& script) -{ if (this->Code) { - os << indent << script << "\n"; - } else { - os << indent << "include(\"" << script << "\")\n"; - } -} - -void cmInstallScriptGenerator::GenerateScriptActions(std::ostream& os, - Indent indent) -{ - if (this->ActionsPerConfig) { - this->cmInstallGenerator::GenerateScriptActions(os, indent); + os << indent << this->Script << "\n"; } else { - this->AddScriptInstallRule(os, indent, this->Script); + os << indent << "include(\"" << this->Script << "\")\n"; } -} -void cmInstallScriptGenerator::GenerateScriptForConfig( - std::ostream& os, const std::string& config, Indent indent) -{ - cmGeneratorExpression ge; - std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(this->Script); - this->AddScriptInstallRule(os, indent, - cge->Evaluate(this->LocalGenerator, config)); + os << indent << "endif()\n\n"; } diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index 534bc1d..fe0f7c6 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -6,13 +6,10 @@ #include "cmConfigure.h" // IWYU pragma: keep #include "cmInstallGenerator.h" -#include "cmScriptGenerator.h" #include <iosfwd> #include <string> -class cmLocalGenerator; - /** \class cmInstallScriptGenerator * \brief Generate target installation rules. */ @@ -23,18 +20,10 @@ public: const char* component, bool exclude_from_all); ~cmInstallScriptGenerator() override; - void Compute(cmLocalGenerator* lg) override; - protected: - void GenerateScriptActions(std::ostream& os, Indent indent) override; - void GenerateScriptForConfig(std::ostream& os, const std::string& config, - Indent indent) override; - void AddScriptInstallRule(std::ostream& os, Indent indent, - std::string const& script); - + void GenerateScript(std::ostream& os) override; std::string Script; bool Code; - cmLocalGenerator* LocalGenerator; }; #endif |