diff options
author | Brad King <brad.king@kitware.com> | 2022-05-17 12:50:27 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-05-17 12:50:33 (GMT) |
commit | 2adfa82e2831a3935ad7aa918bc10270229818f2 (patch) | |
tree | f63f5ba1e7254c97ea6fd26e2e2ff23c8e439136 /Source | |
parent | 37cdf215acaad387797a75d447ae10d1d33ec932 (diff) | |
parent | b0c8e31b54ca7ab2647e9301a12a73c23f887acb (diff) | |
download | CMake-2adfa82e2831a3935ad7aa918bc10270229818f2.zip CMake-2adfa82e2831a3935ad7aa918bc10270229818f2.tar.gz CMake-2adfa82e2831a3935ad7aa918bc10270229818f2.tar.bz2 |
Merge topic 'install-all-components-fix'
b0c8e31b54 install: Don't ignore EXCLUDE_FROM_ALL when used with ALL_COMPONENTS
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7263
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmInstallGenerator.cxx | 19 | ||||
-rw-r--r-- | Source/cmInstallGenerator.h | 3 |
2 files changed, 16 insertions, 6 deletions
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 87110a9..93abd45 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -165,14 +165,22 @@ void cmInstallGenerator::AddInstallRule( } std::string cmInstallGenerator::CreateComponentTest( - const std::string& component, bool exclude_from_all) + const std::string& component, bool exclude_from_all, bool all_components) { + if (all_components) { + if (exclude_from_all) { + return "CMAKE_INSTALL_COMPONENT"; + } + return {}; + } + std::string result = "CMAKE_INSTALL_COMPONENT STREQUAL \""; result += component; result += "\""; if (!exclude_from_all) { result += " OR NOT CMAKE_INSTALL_COMPONENT"; } + return result; } @@ -181,10 +189,11 @@ void cmInstallGenerator::GenerateScript(std::ostream& os) // Track indentation. Indent indent; + std::string component_test = this->CreateComponentTest( + this->Component, this->ExcludeFromAll, this->AllComponents); + // Begin this block of installation. - if (!this->AllComponents) { - std::string component_test = - this->CreateComponentTest(this->Component, this->ExcludeFromAll); + if (!component_test.empty()) { os << indent << "if(" << component_test << ")\n"; } @@ -193,7 +202,7 @@ void cmInstallGenerator::GenerateScript(std::ostream& os) this->AllComponents ? indent : indent.Next()); // End this block of installation. - if (!this->AllComponents) { + if (!component_test.empty()) { os << indent << "endif()\n\n"; } } diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index d342c99..9fcd284 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -78,7 +78,8 @@ protected: void GenerateScript(std::ostream& os) override; std::string CreateComponentTest(const std::string& component, - bool exclude_from_all); + bool exclude_from_all, + bool all_components = false); using TweakMethod = std::function<void(std::ostream& os, Indent indent, |