diff options
author | Brad King <brad.king@kitware.com> | 2018-10-11 11:43:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-10-11 12:11:21 (GMT) |
commit | d26f5b68895b71c53d8ba3a77d1a99fbdd0decd3 (patch) | |
tree | ddf656633a15d2de2e9e7a6188216e42a886cb38 /Source | |
parent | bcfb2457030efcfdb84eef02230aa47f18072555 (diff) | |
parent | 0f48fbaa72fa254faaed6b586fcaa5d3c5c77798 (diff) | |
download | CMake-d26f5b68895b71c53d8ba3a77d1a99fbdd0decd3.zip CMake-d26f5b68895b71c53d8ba3a77d1a99fbdd0decd3.tar.gz CMake-d26f5b68895b71c53d8ba3a77d1a99fbdd0decd3.tar.bz2 |
Merge branch 'backport-revert-install-code-script-genex' into release-3.13
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 3a90f4c..f7e6e44 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.Next() << script << "\n"; - } else { - os << indent.Next() << "include(\"" << script << "\")\n"; - } -} - -void cmInstallScriptGenerator::GenerateScriptActions(std::ostream& os, - Indent indent) -{ - if (this->ActionsPerConfig) { - this->cmInstallGenerator::GenerateScriptActions(os, indent); + os << indent.Next() << this->Script << "\n"; } else { - this->AddScriptInstallRule(os, indent, this->Script); + os << indent.Next() << "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 |