diff options
Diffstat (limited to 'Help/command/if.rst')
-rw-r--r-- | Help/command/if.rst | 64 |
1 files changed, 39 insertions, 25 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst index be992df..72d328d 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -85,8 +85,9 @@ Possible conditions are: (in any directory). ``if(TEST test-name)`` - True if the given name is an existing test name created by the - :command:`add_test` command. + .. versionadded:: 3.3 + True if the given name is an existing test name created by the + :command:`add_test` command. ``if(EXISTS path-to-file-or-directory)`` True if the named file or directory exists. Behavior is well-defined @@ -116,7 +117,9 @@ Possible conditions are: ``if(<variable|string> MATCHES regex)`` True if the given string or variable's value matches the given regular condition. See :ref:`Regex Specification` for regex format. - ``()`` groups are captured in :variable:`CMAKE_MATCH_<n>` variables. + + .. versionadded:: 3.9 + ``()`` groups are captured in :variable:`CMAKE_MATCH_<n>` variables. ``if(<variable|string> LESS <variable|string>)`` True if the given string or variable's value is a valid number and less @@ -131,12 +134,14 @@ Possible conditions are: to that on the right. ``if(<variable|string> LESS_EQUAL <variable|string>)`` - True if the given string or variable's value is a valid number and less - than or equal to that on the right. + .. versionadded:: 3.7 + True if the given string or variable's value is a valid number and less + than or equal to that on the right. ``if(<variable|string> GREATER_EQUAL <variable|string>)`` - True if the given string or variable's value is a valid number and greater - than or equal to that on the right. + .. versionadded:: 3.7 + True if the given string or variable's value is a valid number and greater + than or equal to that on the right. ``if(<variable|string> STRLESS <variable|string>)`` True if the given string or variable's value is lexicographically less @@ -151,12 +156,14 @@ Possible conditions are: to the string or variable on the right. ``if(<variable|string> STRLESS_EQUAL <variable|string>)`` - True if the given string or variable's value is lexicographically less - than or equal to the string or variable on the right. + .. versionadded:: 3.7 + True if the given string or variable's value is lexicographically less + than or equal to the string or variable on the right. ``if(<variable|string> STRGREATER_EQUAL <variable|string>)`` - True if the given string or variable's value is lexicographically greater - than or equal to the string or variable on the right. + .. versionadded:: 3.7 + True if the given string or variable's value is lexicographically greater + than or equal to the string or variable on the right. ``if(<variable|string> VERSION_LESS <variable|string>)`` Component-wise integer version number comparison (version format is @@ -177,25 +184,31 @@ Possible conditions are: component effectively truncates the string at that point. ``if(<variable|string> VERSION_LESS_EQUAL <variable|string>)`` - Component-wise integer version number comparison (version format is - ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). - Any non-integer version component or non-integer trailing part of a version - component effectively truncates the string at that point. + .. versionadded:: 3.7 + Component-wise integer version number comparison (version format is + ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). + Any non-integer version component or non-integer trailing part of a version + component effectively truncates the string at that point. ``if(<variable|string> VERSION_GREATER_EQUAL <variable|string>)`` - Component-wise integer version number comparison (version format is - ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). - Any non-integer version component or non-integer trailing part of a version - component effectively truncates the string at that point. + .. versionadded:: 3.7 + Component-wise integer version number comparison (version format is + ``major[.minor[.patch[.tweak]]]``, omitted components are treated as zero). + Any non-integer version component or non-integer trailing part of a version + component effectively truncates the string at that point. ``if(<variable|string> IN_LIST <variable>)`` - True if the given element is contained in the named list variable. + .. versionadded:: 3.3 + True if the given element is contained in the named list variable. ``if(DEFINED <name>|CACHE{<name>}|ENV{<name>})`` True if a variable, cache variable or environment variable with given ``<name>`` is defined. The value of the variable does not matter. Note that macro arguments are not variables. + .. versionadded:: 3.14 + Added support for ``CACHE{<name>}`` variables. + ``if((condition) AND (condition OR (condition)))`` The conditions inside the parenthesis are evaluated first and then the remaining condition is evaluated as in the previous examples. @@ -268,11 +281,12 @@ above-documented condition syntax accepts ``<variable|string>``: 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`. +.. versionchanged:: 3.1 + 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`. There is no automatic evaluation for environment or cache :ref:`Variable References`. Their values must be referenced as |