summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/cpack_gen/dmg.rst7
-rw-r--r--Help/release/dev/custom-dmg-names.rst7
-rw-r--r--Source/CPack/cmCPackDragNDropGenerator.cxx5
-rw-r--r--Tests/RunCMake/CPack/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake3
-rw-r--r--Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake3
6 files changed, 26 insertions, 1 deletions
diff --git a/Help/cpack_gen/dmg.rst b/Help/cpack_gen/dmg.rst
index 1e37889..35320c2 100644
--- a/Help/cpack_gen/dmg.rst
+++ b/Help/cpack_gen/dmg.rst
@@ -81,6 +81,13 @@ on macOS:
``<language>.menu.txt`` and ``<language>.license.txt`` in the directory
specified by the :variable:`CPACK_DMG_SLA_DIR` variable.
+.. variable:: CPACK_DMG_<component>_FILE_NAME
+
+ File name when packaging ``<component>`` as its own DMG
+ (``CPACK_COMPONENTS_GROUPING`` set to IGNORE).
+
+ - Default: ``CPACK_PACKAGE_FILE_NAME-<component>``
+
.. variable:: CPACK_COMMAND_HDIUTIL
Path to the ``hdiutil(1)`` command used to operate on disk image files on
diff --git a/Help/release/dev/custom-dmg-names.rst b/Help/release/dev/custom-dmg-names.rst
new file mode 100644
index 0000000..73a70a1
--- /dev/null
+++ b/Help/release/dev/custom-dmg-names.rst
@@ -0,0 +1,7 @@
+custom-dmg-names
+----------------
+
+* The :cpack_gen:`CPack DragNDrop Generator` learned to use
+ the :variable:`CPACK_DMG_<component>_FILE_NAME` variable
+ to set a custom filename when packaging components into
+ their own DMGs.
diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx
index ea71007..3516235 100644
--- a/Source/CPack/cmCPackDragNDropGenerator.cxx
+++ b/Source/CPack/cmCPackDragNDropGenerator.cxx
@@ -775,6 +775,11 @@ std::string cmCPackDragNDropGenerator::GetComponentInstallDirNameSuffix(
}
}
+ std::string componentFileName =
+ "CPACK_DMG_" + cmSystemTools::UpperCase(componentName) + "_FILE_NAME";
+ if (this->IsSet(componentFileName)) {
+ return this->GetOption(componentFileName);
+ }
return GetComponentPackageFileName(package_file_name, componentName, false);
}
diff --git a/Tests/RunCMake/CPack/RunCMakeTest.cmake b/Tests/RunCMake/CPack/RunCMakeTest.cmake
index 76d16e1..871e125 100644
--- a/Tests/RunCMake/CPack/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CPack/RunCMakeTest.cmake
@@ -5,7 +5,7 @@ include("${RunCMake_SOURCE_DIR}/CPackTestHelpers.cmake")
# run_cpack_test args: TEST_NAME "GENERATORS" RUN_CMAKE_BUILD_STEP "PACKAGING_TYPES"
run_cpack_test(CUSTOM_BINARY_SPEC_FILE "RPM.CUSTOM_BINARY_SPEC_FILE" false "MONOLITHIC;COMPONENT")
-run_cpack_test(CUSTOM_NAMES "RPM.CUSTOM_NAMES;DEB.CUSTOM_NAMES;TGZ" true "COMPONENT")
+run_cpack_test(CUSTOM_NAMES "RPM.CUSTOM_NAMES;DEB.CUSTOM_NAMES;TGZ;DragNDrop" true "COMPONENT")
run_cpack_test(DEBUGINFO "RPM.DEBUGINFO;DEB.DEBUGINFO" true "COMPONENT")
run_cpack_test_subtests(DEFAULT_PERMISSIONS "CMAKE_var_set;CPACK_var_set;both_set;invalid_CMAKE_var;invalid_CPACK_var" "RPM.DEFAULT_PERMISSIONS;DEB.DEFAULT_PERMISSIONS" false "MONOLITHIC;COMPONENT")
run_cpack_test(DEPENDENCIES "RPM.DEPENDENCIES;DEB.DEPENDENCIES" true "COMPONENT")
diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake
index 07226df..9ac19e2 100644
--- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake
+++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/ExpectedFiles.cmake
@@ -12,4 +12,7 @@ if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
elseif(GENERATOR_TYPE STREQUAL "TGZ")
set(EXPECTED_FILE_2 "second.tar.gz")
set(EXPECTED_FILE_3 "pkg_3_abc.tar.gz")
+elseif(GENERATOR_TYPE STREQUAL "DragNDrop")
+ set(EXPECTED_FILE_2 "second.dmg")
+ set(EXPECTED_FILE_3 "pkg_3_abc.dmg")
endif()
diff --git a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake
index 4c20e41..899258e 100644
--- a/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake
+++ b/Tests/RunCMake/CPack/tests/CUSTOM_NAMES/test.cmake
@@ -10,6 +10,9 @@ if(GENERATOR_TYPE STREQUAL "DEB" OR GENERATOR_TYPE STREQUAL "RPM")
elseif(GENERATOR_TYPE STREQUAL "TGZ")
set(CPACK_ARCHIVE_PKG_2_FILE_NAME "second")
set(CPACK_ARCHIVE_PKG_3_FILE_NAME "pkg_3_abc")
+elseif(GENERATOR_TYPE STREQUAL "DragNDrop")
+ set(CPACK_DMG_PKG_2_FILE_NAME "second")
+ set(CPACK_DMG_PKG_3_FILE_NAME "pkg_3_abc")
endif()
install(FILES CMakeLists.txt DESTINATION foo COMPONENT pkg_1)