Browse Source

CPack: Remove CPACK_INSTALL_CMAKE_CONFIGURATIONS

In commit da5ac4bb60 (cpack: Add `CPACK_INSTALL_CMAKE_CONFIGURATIONS`
variable, 2019-07-10, v3.16.0-rc1~165^2) we added both the variable
and support for `cpack -C` with multiple configurations.  Drop the
variable because the `package` target cannot ensure that all of the
configurations are built.  Keep the command-line interface so that
it can be used manually in scripts.

Fixes: #19918
Alex Turbov 6 years ago
parent
commit
108207cc84

+ 2 - 0
Help/manual/cpack.1.rst

@@ -55,6 +55,8 @@ Options
   When the CMake project uses a multi-configuration
   generator such as Xcode or Visual Studio, this option is needed to tell
   ``cpack`` which built executables to include in the package.
+  The user is responsible for ensuring that the configuration(s) listed
+  have already been built before invoking ``cpack``.
 
 ``-D <var>=<value>``
   Set a CPack variable.  This will override any value set for ``<var>`` in the

+ 2 - 3
Help/release/3.16.rst

@@ -205,9 +205,8 @@ CTest
 CPack
 -----
 
-* CPack variable :variable:`CPACK_INSTALL_CMAKE_CONFIGURATIONS` was added to
-  control what configurations are to be packaged for multi-configuration
-  CMake generators.
+* :manual:`cpack(1)` learned support for multiple configurations for ``-C``
+  option.
 
 * The :cpack_gen:`CPack DEB Generator` is now able to format generic text
   (usually used as the description for multiple CPack generators) according

+ 0 - 7
Modules/CPack.cmake

@@ -301,13 +301,6 @@ The following variables are for advanced uses of CPack:
   project.  Defaults to the value of :variable:`CMAKE_GENERATOR`.  Few users
   will want to change this setting.
 
-.. variable:: CPACK_INSTALL_CMAKE_CONFIGURATIONS
-
-  Specify the project configurations to be packaged (e.g. ``Debug``, ``Release``,
-  etc.). When the CMake project uses a multi-configuration generator such as Xcode
-  or Visual Studio, this option can be used to specify what configurations
-  to include in the package.
-
 .. variable:: CPACK_INSTALL_CMAKE_PROJECTS
 
   List of four values that specify what project to install.  The four values

+ 0 - 8
Source/CPack/cmCPackGenerator.cxx

@@ -605,14 +605,6 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
         cmExpandList(buildConfig, buildConfigs);
       }
 
-      // Try get configurations requested by the user explicitly
-      {
-        const char* const configsCstr =
-          this->GetOption("CPACK_INSTALL_CMAKE_CONFIGURATIONS");
-        auto configs = configsCstr ? configsCstr : std::string{};
-        cmExpandList(configs, buildConfigs);
-      }
-
       // Remove duplicates
       std::sort(buildConfigs.begin(), buildConfigs.end());
       buildConfigs.erase(std::unique(buildConfigs.begin(), buildConfigs.end()),

+ 0 - 3
Tests/RunCMake/CPack/RunCMakeTest.cmake

@@ -36,9 +36,6 @@ run_cpack_test(MD5SUMS "DEB.MD5SUMS" false "MONOLITHIC;COMPONENT")
 run_cpack_test_subtests(CPACK_INSTALL_SCRIPTS "singular;plural;both" "ZIP" false "MONOLITHIC")
 run_cpack_test(DEB_PACKAGE_VERSION_BACK_COMPATIBILITY "DEB.DEB_PACKAGE_VERSION_BACK_COMPATIBILITY" false "MONOLITHIC;COMPONENT")
 run_cpack_test_subtests(EXTERNAL "none;good;good_multi;bad_major;bad_minor;invalid_good;invalid_bad;stage_and_package" "External" false "MONOLITHIC;COMPONENT")
-if(RunCMake_GENERATOR MATCHES "Visual Studio|Xcode")
-  run_cpack_test(CPACK_INSTALL_CMAKE_CONFIGURATIONS "ZIP" false "MONOLITHIC")
-endif()
 run_cpack_test_subtests(
   DEB_DESCRIPTION
   "CPACK_DEBIAN_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION;CPACK_PACKAGE_DESCRIPTION_FILE"

+ 0 - 3
Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ExpectedFiles.cmake

@@ -1,3 +0,0 @@
-set(EXPECTED_FILES_COUNT "1")
-
-set(EXPECTED_FILE_CONTENT_1_LIST "foo;foo/debug.txt;foo/release.txt")

+ 0 - 3
Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/ZIP-stdout.txt

@@ -1,3 +0,0 @@
-CPack: Install projects
-CPack: - Install project: CPACK_INSTALL_CMAKE_CONFIGURATIONS-MONOLITHIC-type \[Debug\]
-CPack: - Install project: CPACK_INSTALL_CMAKE_CONFIGURATIONS-MONOLITHIC-type \[Release\]

+ 0 - 9
Tests/RunCMake/CPack/tests/CPACK_INSTALL_CMAKE_CONFIGURATIONS/test.cmake

@@ -1,9 +0,0 @@
-set(CMAKE_CONFIGURATION_TYPES Debug Release)
-
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/debug.txt" "debug content")
-file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/release.txt" "release content")
-
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/debug.txt" DESTINATION "foo" CONFIGURATIONS Debug)
-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/release.txt" DESTINATION "foo" CONFIGURATIONS Release)
-
-set(CPACK_INSTALL_CMAKE_CONFIGURATIONS ${CMAKE_CONFIGURATION_TYPES})