summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/CPack/cmCPackGenerator.cxx5
-rw-r--r--Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake1
2 files changed, 4 insertions, 2 deletions
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 67005ef2b1..995eb0d979 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -1499,7 +1499,10 @@ bool cmCPackGenerator::SupportsComponentInstallation() const
//----------------------------------------------------------------------
bool cmCPackGenerator::WantsComponentInstallation() const
{
- return (!IsOn("CPACK_MONOLITHIC_INSTALL") & SupportsComponentInstallation());
+ return (!IsOn("CPACK_MONOLITHIC_INSTALL")
+ && SupportsComponentInstallation()
+ // check that package at least has components
+ && !(this->ComponentGroups.empty() || this->Components.empty()));
}
//----------------------------------------------------------------------
diff --git a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake b/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake
index 3ace6a8150..31e729bfe4 100644
--- a/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake
+++ b/Tests/RunCMake/CPackRPM/CPackRPM_PARTIALLY_RELOCATABLE_WARNING.cmake
@@ -1,5 +1,4 @@
install(FILES CMakeLists.txt DESTINATION /not_relocatable COMPONENT static)
-install(FILES CMakeLists.txt DESTINATION relocatable COMPONENT relocatable)
set(CPACK_PACKAGE_RELOCATABLE TRUE)
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt")