summaryrefslogtreecommitdiffstats
path: root/Help/command
diff options
context:
space:
mode:
authorChuck Atkins <chuck.atkins@kitware.com>2016-08-05 18:11:46 (GMT)
committerBrad King <brad.king@kitware.com>2016-08-09 13:30:34 (GMT)
commit02d177c9cc05514baccfa530ab85eec65374fbcb (patch)
tree2fbef7a16d4acac2b3b7218ef1abd16690566d9a /Help/command
parent93b705a396c23f771ba203efb6f2f4934ae027b7 (diff)
downloadCMake-02d177c9cc05514baccfa530ab85eec65374fbcb.zip
CMake-02d177c9cc05514baccfa530ab85eec65374fbcb.tar.gz
CMake-02d177c9cc05514baccfa530ab85eec65374fbcb.tar.bz2
Add additional <= and >= comparison operators
This adds the LESS_EQUAL, GREATER_EQUAL, and associated STR and VERSION equivalents to use the combined <= and >= functionality.
Diffstat (limited to 'Help/command')
-rw-r--r--Help/command/if.rst59
-rw-r--r--Help/command/string.rst6
2 files changed, 47 insertions, 18 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst
index 56e618c..0941029 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -30,10 +30,12 @@ else and endif clause is optional. Long expressions can be used and
there is a traditional order of precedence. Parenthetical expressions
are evaluated first followed by unary tests such as ``EXISTS``,
``COMMAND``, and ``DEFINED``. Then any binary tests such as
-``EQUAL``, ``LESS``, ``GREATER``, ``STRLESS``, ``STRGREATER``,
-``STREQUAL``, and ``MATCHES`` will be evaluated. Then boolean ``NOT``
-operators and finally boolean ``AND`` and then ``OR`` operators will
-be evaluated.
+``EQUAL``, ``LESS``, ``LESS_EQUAL, ``GREATER``, ``GREATER_EQUAL``,
+``STREQUAL``, ``STRLESS``, ``STRLESS_EQUAL``, ``STRGREATER``,
+``STRGREATER_EQUAL``, ``VERSION_EQUAL``, ``VERSION_LESS``,
+``VERSION_LESS_EQUAL``, ``VERSION_GREATER``, ``VERSION_GREATER_EQUAL``,
+and ``MATCHES`` will be evaluated. Then boolean ``NOT`` operators and
+finally boolean ``AND`` and then ``OR`` operators will be evaluated.
Possible expressions are:
@@ -115,6 +117,14 @@ Possible expressions are:
True if the given string or variable's value is a valid number and equal
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.
+
+``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.
+
``if(<variable|string> STRLESS <variable|string>)``
True if the given string or variable's value is lexicographically less
than the string or variable on the right.
@@ -127,15 +137,31 @@ Possible expressions are:
True if the given string or variable's value is lexicographically equal
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.
+
+``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.
+
``if(<variable|string> VERSION_LESS <variable|string>)``
Component-wise integer version number comparison (version format is
``major[.minor[.patch[.tweak]]]``).
+``if(<variable|string> VERSION_GREATER <variable|string>)``
+ Component-wise integer version number comparison (version format is
+ ``major[.minor[.patch[.tweak]]]``).
+
``if(<variable|string> VERSION_EQUAL <variable|string>)``
Component-wise integer version number comparison (version format is
``major[.minor[.patch[.tweak]]]``).
-``if(<variable|string> VERSION_GREATER <variable|string>)``
+``if(<variable|string> VERSION_LESS_EQUAL <variable|string>)``
+ Component-wise integer version number comparison (version format is
+ ``major[.minor[.patch[.tweak]]]``).
+
+``if(<variable|string> VERSION_GREATER_EQUAL <variable|string>)``
Component-wise integer version number comparison (version format is
``major[.minor[.patch[.tweak]]]``).
@@ -186,20 +212,21 @@ above-documented signature accepts ``<variable|string>``:
* If the left hand argument to ``MATCHES`` is missing it returns false
without error
-* Both left and right hand arguments to ``LESS``, ``GREATER``, and
- ``EQUAL`` are independently tested to see if they are defined
- variables, if so their defined values are used otherwise the original
- value is used.
+* Both left and right hand arguments to ``LESS``, ``GREATER``, ``EQUAL``,
+ ``LESS_EQUAL``, and ``GREATER_EQUAL``, are independently tested to see if
+ they are defined variables, if so their defined values are used otherwise
+ the original value is used.
-* Both left and right hand arguments to ``STRLESS``, ``STREQUAL``, and
- ``STRGREATER`` are independently tested to see if they are defined
- variables, if so their defined values are used otherwise the original
- value is used.
+* Both left and right hand arguments to ``STRLESS``, ``STRGREATER``,
+ ``STREQUAL``, ``STRLESS_EQUAL``, and ``STRGREATER_EQUAL`` are independently
+ tested to see if they are defined variables, if so their defined values are
+ used otherwise the original value is used.
* Both left and right hand arguments to ``VERSION_LESS``,
- ``VERSION_EQUAL``, and ``VERSION_GREATER`` are independently tested
- to see if they are defined variables, if so their defined values are
- used otherwise the original value is used.
+ ``VERSION_GREATER``, ``VERSION_EQUAL``, ``VERSION_LESS_EQUAL``, and
+ ``VERSION_GREATER_EQUAL`` are independently tested to see if they are defined
+ variables, if so their defined values are used otherwise the original value
+ is used.
* The right hand argument to ``NOT`` is tested to see if it is a boolean
constant, if so the value is used, otherwise it is assumed to be a
diff --git a/Help/command/string.rst b/Help/command/string.rst
index 3f4050e..19a095a 100644
--- a/Help/command/string.rst
+++ b/Help/command/string.rst
@@ -197,10 +197,12 @@ Comparison
::
- string(COMPARE EQUAL <string1> <string2> <output variable>)
- string(COMPARE NOTEQUAL <string1> <string2> <output variable>)
string(COMPARE LESS <string1> <string2> <output variable>)
string(COMPARE GREATER <string1> <string2> <output variable>)
+ string(COMPARE EQUAL <string1> <string2> <output variable>)
+ string(COMPARE NOTEQUAL <string1> <string2> <output variable>)
+ string(COMPARE LESS_EQUAL <string1> <string2> <output variable>)
+ string(COMPARE GREATER_EQUAL <string1> <string2> <output variable>)
Compare the strings and store true or false in the output variable.