mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 22:58:37 -05:00
Merge topic 'if-sanity'
858d5a0bFix if() checks of CMAKE_SYSTEM_NAME on Cygwine177e7afFPHSA: Avoid if() dereferencing of quoted variable425acc52cmcurl: Use if(DEFINED) to simplify conditionscede5cbdlibarchive: Avoid depending on if() to dereference a quoted variable2d97178bFindGTK2: Avoid depending on if() to dereference a quoted variable0b12815dModules/Test*.cmake: Use if(DEFINED) to simplify conditions188a1f23If: Introduce policy CMP0054 - don't dereference quoted variables in if()b900c1ccIf: Extract cmConditionEvaluator from if() implementation
This commit is contained in:
@@ -199,3 +199,9 @@ above-documented signature accepts ``<variable|string>``:
|
||||
* The left and right hand arguments to ``AND`` and ``OR`` are independently
|
||||
tested to see if they are boolean constants, if so they are used as
|
||||
such, otherwise they are assumed to be variables and are dereferenced.
|
||||
|
||||
To prevent ambiguity, potential variable or keyword names can be
|
||||
specified in a :ref:`Quoted Argument` or a :ref:`Bracket Argument`.
|
||||
A quoted or bracketed variable or keyword will be interpreted as a
|
||||
string and not dereferenced or interpreted.
|
||||
See policy :policy:`CMP0054`.
|
||||
|
||||
@@ -105,3 +105,4 @@ All Policies
|
||||
/policy/CMP0051
|
||||
/policy/CMP0052
|
||||
/policy/CMP0053
|
||||
/policy/CMP0054
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
CMP0054
|
||||
-------
|
||||
|
||||
Only interpret :command:`if` arguments as variables or keywords when unquoted.
|
||||
|
||||
CMake 3.1 and above no longer dereference variables or interpret keywords
|
||||
in an :command:`if` command argument when it is a :ref:`Quoted Argument`
|
||||
or a :ref:`Bracket Argument`.
|
||||
|
||||
The ``OLD`` behavior for this policy is to dereference variables and
|
||||
interpret keywords even if they are quoted or bracketed.
|
||||
The ``NEW`` behavior is to not dereference variables or interpret keywords
|
||||
that have been quoted or bracketed.
|
||||
|
||||
This policy was introduced in CMake version 3.1.
|
||||
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.
|
||||
@@ -0,0 +1,6 @@
|
||||
if-sanity
|
||||
---------
|
||||
|
||||
* The :command:`if` command no longer automatically dereferences
|
||||
variables named in quoted or bracket arguments. See policy
|
||||
:policy:`CMP0054`.
|
||||
Reference in New Issue
Block a user