diff options
author | Brad King <brad.king@kitware.com> | 2020-01-22 14:50:37 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-01-22 14:50:49 (GMT) |
commit | 15c573df4115ab1be01da118c91b4d942e9007d6 (patch) | |
tree | 1b053b88a918326e5f6ebf2c91e132474b0fd772 /Help | |
parent | 39695f6fb316de2289636de483f52d53096ac41d (diff) | |
parent | 3ec82b713e51711df0c70f539aea62fc16dd3060 (diff) | |
download | CMake-15c573df4115ab1be01da118c91b4d942e9007d6.zip CMake-15c573df4115ab1be01da118c91b4d942e9007d6.tar.gz CMake-15c573df4115ab1be01da118c91b4d942e9007d6.tar.bz2 |
Merge topic 'mark_as_advanced-without-cache'
3ec82b713e cmMarkAsAdvancedCommand: ignore variables which don't exist in the cache
701a5c60e0 cmake: avoid marking local or unused variables as advanced
af158149e7 FindOpenSSL: do not mark a local variable as advanced
74f659f1f2 FindCurses: only mark CURSES_EXTRA_LIBRARY when it is used
7e2ae4e96d FindOpenGL: only mark declared cache variables as advanced
7cc02a0c29 FindLua: only mark LUA_MATH_LIBRARY as advanced if required
85cd26b8a6 FindBoost: only mark Boost_DIR as advanced if defined
338c7916ba CTest: avoid marking undeclared cache variables as advanced
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4150
Diffstat (limited to 'Help')
-rw-r--r-- | Help/command/mark_as_advanced.rst | 6 | ||||
-rw-r--r-- | Help/manual/cmake-policies.7.rst | 1 | ||||
-rw-r--r-- | Help/policy/CMP0102.rst | 25 | ||||
-rw-r--r-- | Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst | 2 |
4 files changed, 34 insertions, 0 deletions
diff --git a/Help/command/mark_as_advanced.rst b/Help/command/mark_as_advanced.rst index 5712fb4..e52e623 100644 --- a/Help/command/mark_as_advanced.rst +++ b/Help/command/mark_as_advanced.rst @@ -22,3 +22,9 @@ If neither ``FORCE`` nor ``CLEAR`` is specified, new values will be marked as advanced, but if a variable already has an advanced/non-advanced state, it will not be changed. + +.. note:: + + Policy :policy:`CMP0102` affects the behavior of the ``mark_as_advanced`` + call. When set to ``NEW``, variables passed to this command which are not + already in the cache are ignored. See policy :policy:`CMP0102`. diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 53cf264..c256250 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -57,6 +57,7 @@ Policies Introduced by CMake 3.17 .. toctree:: :maxdepth: 1 + CMP0102: mark_as_advanced() does nothing if a cache entry does not exist. </policy/CMP0102> CMP0101: target_compile_options honors BEFORE keyword in all scopes. </policy/CMP0101> CMP0100: Let AUTOMOC and AUTOUIC process .hh header files. </policy/CMP0100> CMP0099: Link properties are transitive over private dependency on static libraries. </policy/CMP0099> diff --git a/Help/policy/CMP0102.rst b/Help/policy/CMP0102.rst new file mode 100644 index 0000000..9859006 --- /dev/null +++ b/Help/policy/CMP0102.rst @@ -0,0 +1,25 @@ +CMP0102 +------- + +The :command:`mark_as_advanced` command no longer creates a cache entry if one +does not already exist. + +In CMake 3.16 and below, if a variable was not defined at all or just defined +locally, the :command:`mark_as_advanced` command would create a new cache +entry with an ``UNINITIALIZED`` type and no value. When a :command:`find_path` +(or other similar ``find_`` command) would next run, it would find this +undefined cache entry and set it up with an empty string value. This process +would end up deleting the local variable in the process (due to the way the +cache works), effectively clearing any stored ``find_`` results that were only +available in the local scope. + +The ``OLD`` behavior for this policy is to create the empty cache definition. +The ``NEW`` behavior of this policy is to ignore variables which do not +already exist in the cache. + +This policy was introduced in CMake version 3.17. Use the +:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly. +Unlike many policies, CMake version |release| does *not* warn +when this policy is not set and simply uses ``OLD`` behavior. + +.. include:: DEPRECATED.txt diff --git a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst index fc52e7b..de71d0e 100644 --- a/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst +++ b/Help/variable/CMAKE_POLICY_WARNING_CMPNNNN.rst @@ -23,6 +23,8 @@ warn by default: policy :policy:`CMP0082`. * ``CMAKE_POLICY_WARNING_CMP0089`` controls the warning for policy :policy:`CMP0089`. +* ``CMAKE_POLICY_WARNING_CMP0102`` controls the warning for + policy :policy:`CMP0102`. This variable should not be set by a project in CMake code. Project developers running CMake may set this variable in their cache to |