1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-05-09 06:42:18 +08:00

Merge topic 'cpack-dmg-sla'

b760828d3f CPack/DMG: Do not use CPACK_RESOURCE_FILE_LICENSE for SLA by default

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7176
This commit is contained in:
Brad King 2022-04-20 15:38:10 +00:00 committed by Kitware Robot
commit 722e4d4619
15 changed files with 91 additions and 6 deletions

View File

@ -65,8 +65,8 @@ on macOS:
In a CMake project that uses the :module:`CPack` module to generate
``CPackConfig.cmake``, ``CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE``
is automatically enabled by default if it is not set and
:variable:`CPACK_RESOURCE_FILE_LICENSE` is set to a non-default value.
must be explicitly enabled by the project to activate the SLA.
See policy :policy:`CMP0133`.
.. note::

View File

@ -58,6 +58,7 @@ Policies Introduced by CMake 3.24
.. toctree::
:maxdepth: 1
CMP0133: The CPack module disables SLA by default in the CPack DragNDrop Generator. </policy/CMP0133>
CMP0132: Do not set compiler environment variables on first run. </policy/CMP0132>
CMP0131: LINK_LIBRARIES supports the LINK_ONLY generator expression. </policy/CMP0131>
CMP0130: while() diagnoses condition evaluation errors. </policy/CMP0130>

32
Help/policy/CMP0133.rst Normal file
View File

@ -0,0 +1,32 @@
CMP0133
-------
.. versionadded:: 3.24
The :module:`CPack` module disables SLA by default in the
:cpack_gen:`CPack DragNDrop Generator`.
The :cpack_gen:`CPack DragNDrop Generator` in CMake 3.22 and below attach a
Software License Agreement (SLA) to ``.dmg`` files using the file specified
by :variable:`CPACK_RESOURCE_FILE_LICENSE`, if set to a non-default value.
macOS 12.0 deprecated the tools used to do this, so CMake 3.23 added
the :variable:`CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE` option to
control the behavior. CMake 3.23 enables that option by default for
compatibility with older versions. CMake 3.24 and above prefer to *not*
enable the :variable:`CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE` option by
default. This policy provides compatibility with projects that have not
been updated to account for the lack of a SLA in their ``.dmg`` packages.
The ``OLD`` behavior for this policy is to enable
:variable:`CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE` by default.
The ``NEW`` behavior for this policy is to not enable it by default.
This policy was introduced in CMake version 3.24. Use the
:command:`cmake_policy` command to set this policy to ``OLD`` or ``NEW``
explicitly. Unlike many policies, CMake version |release| does *not* warn
by default when this policy is not set and simply uses ``OLD`` behavior.
See documentation of the
:variable:`CMAKE_POLICY_WARNING_CMP0133 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
variable to control the warning.
.. include:: DEPRECATED.txt

View File

@ -0,0 +1,6 @@
cpack-dmg-sla
-------------
* The :module:`CPack` module no longer enables the SLA by default in the
:cpack_gen:`CPack DragNDrop Generator`. See policy :policy:`CMP0133`
and the :variable:`CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE` variable.

View File

@ -36,6 +36,8 @@ only for the policies that do not warn by default:
policy :policy:`CMP0128`.
* ``CMAKE_POLICY_WARNING_CMP0129`` controls the warning for
policy :policy:`CMP0129`.
* ``CMAKE_POLICY_WARNING_CMP0133`` controls the warning for
policy :policy:`CMP0133`.
This variable should not be set by a project in CMake code. Project
developers running CMake may set this variable in their cache to

View File

@ -817,8 +817,20 @@ _cpack_set_default(CPACK_NSIS_INSTALLER_ICON_CODE "")
_cpack_set_default(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
# DragNDrop specific variables
if(CPACK_RESOURCE_FILE_LICENSE AND NOT CPACK_RESOURCE_FILE_LICENSE STREQUAL "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
_cpack_set_default(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE ON)
if(NOT DEFINED CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE
AND CPACK_RESOURCE_FILE_LICENSE AND NOT CPACK_RESOURCE_FILE_LICENSE STREQUAL "${CMAKE_ROOT}/Templates/CPack.GenericLicense.txt")
cmake_policy(GET CMP0133 _CPack_CMP0133)
if(NOT "x${_CPack_CMP0133}x" STREQUAL "xNEWx")
if(NOT "x${_CPack_CMP0133}x" STREQUAL "xOLDx" AND CMAKE_POLICY_WARNING_CMP0133)
cmake_policy(GET_WARNING CMP0133 _CMP0133_warning)
message(AUTHOR_WARNING
"${_CMP0133_warning}\n"
"For compatibility, CMake will enable the SLA in the CPack DragNDrop Generator."
)
endif()
_cpack_set_default(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE ON)
endif()
unset(_CPack_CMP0133)
endif()
# WiX specific variables

View File

@ -396,7 +396,11 @@ class cmMakefile;
24, 0, cmPolicies::WARN) \
SELECT(POLICY, CMP0132, \
"Do not set compiler environment variables on first run", 3, 24, 0, \
cmPolicies::WARN)
cmPolicies::WARN) \
SELECT(POLICY, CMP0133, \
"The CPack module disables SLA by default in the CPack DragNDrop " \
"Generator.", \
3, 24, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \

View File

@ -0,0 +1,3 @@
include(${RunCMake_SOURCE_DIR}/check.cmake)
test_variable(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE "")

View File

@ -0,0 +1,2 @@
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/SLA.txt")
cmake_policy(SET CMP0133 NEW)

View File

@ -0,0 +1,3 @@
include(${RunCMake_SOURCE_DIR}/check.cmake)
test_variable(CPACK_DMG_SLA_USE_RESOURCE_FILE_LICENSE "ON")

View File

@ -0,0 +1,12 @@
^CMake Warning \(dev\) at [^
]*/Modules/CPack.cmake:[0-9]+ \(message\):
Policy CMP0133 is not set: The CPack module disables SLA by default in the
CPack DragNDrop Generator. Run "cmake --help-policy CMP0133" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
For compatibility, CMake will enable the SLA in the CPack DragNDrop
Generator.
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
This warning is for project developers. Use -Wno-dev to suppress it.$

View File

@ -0,0 +1,2 @@
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/SLA.txt")
set(CMAKE_POLICY_WARNING_CMP0133 1)

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.3)
project(${RunCMake_TEST})
include(${RunCMake_TEST}.cmake)
include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE)
include(CPack)

View File

@ -1,5 +1,7 @@
include(RunCMake)
run_cmake(CMP0133-NEW)
run_cmake(CMP0133-WARN)
run_cmake(Simple)
run_cmake(Default)
run_cmake(Special)

View File

@ -0,0 +1,4 @@
Example License File
--------------------
This is an example license file for a DMG.