summaryrefslogtreecommitdiffstats
path: root/Help/command/if.rst
diff options
context:
space:
mode:
authorNikita Nemkin <nikita@nemkin.ru>2020-11-07 20:30:30 (GMT)
committerNikita Nemkin <nikita@nemkin.ru>2020-11-09 15:51:57 (GMT)
commitc705279bae45c85b689febd66d5437d9ec05c9b9 (patch)
treef64bca14f17a902a96d67a30357df3d1e6c745eb /Help/command/if.rst
parent63a1917d098922b59bbba8fdeb42519363d5ba0d (diff)
downloadCMake-c705279bae45c85b689febd66d5437d9ec05c9b9.zip
CMake-c705279bae45c85b689febd66d5437d9ec05c9b9.tar.gz
CMake-c705279bae45c85b689febd66d5437d9ec05c9b9.tar.bz2
Help: Add `.. versionadded` directives to commands documentation
This change ony concerns directives that appear in the document body. The guidelines for inserting version directives: * Baseline version is CMake 3.0, i.e. directives start at 3.1. * Always use `.. versionadded::` directive, avoid ad-hoc version references. Exception: policy pages. * For new command signatures, put `versionadded` on a separate line after the signature. * For a group of new signatures in a new document section, a single version note at the beginning of the section is sufficient. * For new options, put `versionadded` on a separate line before option description. * If all the option descriptions in the list are short one-liners, it's fine to put `versionadded` on the same line as the description. * If multiple option descriptions in close proximity would have the same ..versionadded directive, consider adding a single directive after the list, mentioning all added options. * For compact value lists and sub-option lists, put a single `versionadded` directive after the list mentioning all additions. * When a change is described in a single paragraph, put `versionadded` into that paragraph. * When only part of the paragraph has changed, separate the changed part if it doesn't break the flow. Otherwise, write a follow-up clarification paragraph and apply version directive to that. * When multiple version directives are close by, order earlier additions before later additions. * Indent related lists and code blocks to include them in the scope of `versionadded` directive. Issue: #19715
Diffstat (limited to 'Help/command/if.rst')
-rw-r--r--Help/command/if.rst64
1 files changed, 39 insertions, 25 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst
index be992df..3b01463 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`.
+.. versionadded:: 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