diff options
author | Brad King <brad.king@kitware.com> | 2022-01-14 16:40:23 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-01-18 20:39:51 (GMT) |
commit | 9e38bfa915c142edcf7d6e154fa1dc10bba400f1 (patch) | |
tree | a3ebdbd672c3fba3be1d107e93b60152254fdb96 /Tests/RunCMake/CPack/tests | |
parent | 542ba6ac1a50c3900457431819e5eb328f3a29ee (diff) | |
download | CMake-9e38bfa915c142edcf7d6e154fa1dc10bba400f1.zip CMake-9e38bfa915c142edcf7d6e154fa1dc10bba400f1.tar.gz CMake-9e38bfa915c142edcf7d6e154fa1dc10bba400f1.tar.bz2 |
CPack/DMG: Add explicit option to use CPACK_RESOURCE_FILE_LICENSE for SLA
Since macOS 12.0, the ``hdiutil udifrez`` and ``hdiutil udifderez``
commands to embed and extract resources in a disk image are deprecated.
The CPack DragNDrop Generator uses these to attach the SLA specified by
the `CPACK_RESOURCE_FILE_LICENSE` option. Since that option is shared
by multiple CPack generators, we cannot deprecate it. Instead, add an
explicit option to control the behavior. This will give projects a way
to package on future macOS versions that remove the commands.
In order to provide a long-term transition away from attaching SLAs to
disk images, update `cpack` to default this behavior to OFF. To retain
compatibility for CMake projects, teach the CPack module to default the
option to ON. Later a policy can be added to change the default.
Issue: #22978
Diffstat (limited to 'Tests/RunCMake/CPack/tests')
4 files changed, 21 insertions, 0 deletions
diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/Example.txt b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/Example.txt new file mode 100644 index 0000000..94b19c3 --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/Example.txt @@ -0,0 +1,4 @@ +Example License File +-------------------- + +This is an example license file for a DMG. diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/ExpectedFiles.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/ExpectedFiles.cmake new file mode 100644 index 0000000..d1a3a5f --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/ExpectedFiles.cmake @@ -0,0 +1,2 @@ +set(EXPECTED_FILES_COUNT "1") +set(EXPECTED_FILE_CONTENT_1_LIST "/foo;/foo/CMakeLists.txt") diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/VerifyResult.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/VerifyResult.cmake new file mode 100644 index 0000000..571a4df --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/VerifyResult.cmake @@ -0,0 +1,12 @@ +set(dmg "${bin_dir}/${FOUND_FILE_1}") +execute_process(COMMAND hdiutil udifderez -xml "${dmg}" OUTPUT_VARIABLE out ERROR_VARIABLE err RESULT_VARIABLE res) +if(NOT res EQUAL 0) + string(REPLACE "\n" "\n " err " ${err}") + message(FATAL_ERROR "Running 'hdiutil udifderez -xml' on\n ${dmg}\nfailed with:\n${err}") +endif() +foreach(key "LPic" "STR#" "TEXT") + if(out MATCHES "<key>${key}</key>") + string(REPLACE "\n" "\n " out " ${out}") + message(FATAL_ERROR "error: running 'hdiutil udifderez -xml' on\n ${dmg}\nhas unexpected '${key}' key:\n${out}") + endif() +endforeach() diff --git a/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/test.cmake b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/test.cmake new file mode 100644 index 0000000..2b09cab --- /dev/null +++ b/Tests/RunCMake/CPack/tests/DMG_SLA_OFF/test.cmake @@ -0,0 +1,3 @@ +install(FILES CMakeLists.txt DESTINATION foo) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/Example.txt") +set(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE OFF) |