mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-26 00:00:39 -05:00
while: diagnose errors during condition evaluation
Add a policy to diagnose condition errors in a compatible way. Fixes: #23296
This commit is contained in:
@@ -52,6 +52,14 @@ to determine whether to report an error on use of deprecated macros or
|
||||
functions.
|
||||
|
||||
|
||||
Policies Introduced by CMake 3.24
|
||||
=================================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
CMP0130: while() diagnoses condition evaluation errors. </policy/CMP0130>
|
||||
|
||||
Policies Introduced by CMake 3.23
|
||||
=================================
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
CMP0130
|
||||
-------
|
||||
|
||||
.. versionadded:: 3.24
|
||||
|
||||
:command:`while` diagnoses condition evaluation errors.
|
||||
|
||||
CMake 3.23 and below accidentally tolerated errors encountered while
|
||||
evaluating the condition passed to the :command:`while` command
|
||||
(but not the :command:`if` command). For example, the code
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
set(paren "(")
|
||||
while(${paren})
|
||||
endwhile()
|
||||
|
||||
creates an unbalanced parenthesis during condition evaluation.
|
||||
|
||||
CMake 3.24 and above prefer to diagnose such errors. This policy
|
||||
provides compatibility for projects that have not been updated to
|
||||
fix their condition errors.
|
||||
|
||||
The ``OLD`` behavior for this policy is to ignore errors in
|
||||
:command:`while` conditions. The ``NEW`` behavior for this
|
||||
policy is to diagnose errors in :command:`while` conditions.
|
||||
|
||||
This policy was introduced in CMake version 3.24. CMake version |release|
|
||||
warns when the policy is not set and uses ``OLD`` behavior. Use the
|
||||
:command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` explicitly.
|
||||
|
||||
.. include:: DEPRECATED.txt
|
||||
@@ -0,0 +1,5 @@
|
||||
while-errors
|
||||
------------
|
||||
|
||||
* The :command:`while` command now diagnoses errors during condition
|
||||
evaluation. See policy :policy:`CMP0130`.
|
||||
Reference in New Issue
Block a user