mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-24 07:08:38 -05:00
Do not define CMAKE_PARENT_LIST_FILE in CMakeLists.txt
Add policy `CMP0198` for compatibility. Issue: #25026
This commit is contained in:
@@ -92,6 +92,14 @@ Supported Policies
|
||||
|
||||
The following policies are supported.
|
||||
|
||||
Policies Introduced by CMake 4.2
|
||||
--------------------------------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
CMP0198: CMAKE_PARENT_LIST_FILE is not defined in CMakeLists.txt. </policy/CMP0198>
|
||||
|
||||
Policies Introduced by CMake 4.1
|
||||
--------------------------------
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
CMP0198
|
||||
-------
|
||||
|
||||
.. versionadded:: 4.2
|
||||
|
||||
:variable:`CMAKE_PARENT_LIST_FILE` is not defined in ``CMakeLists.txt``.
|
||||
|
||||
CMake 4.1 and below defined ``CMAKE_PARENT_LIST_FILE`` when processing
|
||||
a ``CMakeLists.txt`` even though there is no parent file. CMake 4.2
|
||||
and above prefer to not define ``CMAKE_PARENT_LIST_FILE``. This policy
|
||||
provides compatibility for projects that accidentally relied on the
|
||||
old behavior.
|
||||
|
||||
The ``OLD`` behavior for this policy is to set
|
||||
:variable:`CMAKE_PARENT_LIST_FILE` to :variable:`CMAKE_CURRENT_LIST_FILE`
|
||||
when processing a ``CMakeLists.txt``. The ``NEW`` behavior for this policy
|
||||
is to not set :variable:`CMAKE_PARENT_LIST_FILE`.
|
||||
|
||||
.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.2
|
||||
.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
|
||||
.. include:: include/STANDARD_ADVICE.rst
|
||||
|
||||
.. include:: include/DEPRECATED.rst
|
||||
@@ -0,0 +1,5 @@
|
||||
cmake-parent-fix
|
||||
----------------
|
||||
|
||||
* :variable:`CMAKE_PARENT_LIST_FILE` is no longer defined when processing
|
||||
a ``CMakeLists.txt`` file. See policy :policy:`CMP0198`.
|
||||
@@ -8,7 +8,8 @@ While processing a CMake file loaded by :command:`include` or
|
||||
including it.
|
||||
|
||||
While processing a ``CMakeLists.txt`` file, even in subdirectories,
|
||||
this variable has the same value as :variable:`CMAKE_CURRENT_LIST_FILE`.
|
||||
this variable is not defined. See policy :policy:`CMP0198`.
|
||||
|
||||
While processing a :option:`cmake -P` script, this variable is not defined
|
||||
in the outermost script.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user