Przeglądaj źródła

CPack single component packaging

RPM, DEB and archive packages were not created
in cases when CPACK_<generator>_COMPONENT_INSTALL
was set to ON and a single component existed.
Patch also changes CPackRPM test to implicitly
test for this case.
Domen Vrankar 10 lat temu
rodzic
commit
0ffd35340e

+ 4 - 1
Source/CPack/cmCPackGenerator.cxx

@@ -1499,7 +1499,10 @@ bool cmCPackGenerator::SupportsComponentInstallation() const
 //----------------------------------------------------------------------
 //----------------------------------------------------------------------
 bool cmCPackGenerator::WantsComponentInstallation() 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()));
 }
 }
 
 
 //----------------------------------------------------------------------
 //----------------------------------------------------------------------

+ 0 - 1
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 /not_relocatable COMPONENT static)
-install(FILES CMakeLists.txt DESTINATION relocatable COMPONENT relocatable)
 
 
 set(CPACK_PACKAGE_RELOCATABLE TRUE)
 set(CPACK_PACKAGE_RELOCATABLE TRUE)
 set(CPACK_PACKAGING_INSTALL_PREFIX "/opt")
 set(CPACK_PACKAGING_INSTALL_PREFIX "/opt")