summaryrefslogtreecommitdiffstats
path: root/Help
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
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')
-rw-r--r--Help/command/if.rst59
-rw-r--r--Help/command/string.rst6
-rw-r--r--Help/manual/cmake-generator-expressions.7.rst8
-rw-r--r--Help/release/dev/add-extra-boolean-comparisons.rst6
-rw-r--r--Help/variable/CMAKE_VERSION.rst10
5 files changed, 64 insertions, 25 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.
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index d4f47dd..64d15a9 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -66,12 +66,16 @@ Available logical expressions are:
``1`` if the CMake-id of the C compiler matches ``comp``, otherwise ``0``.
``$<CXX_COMPILER_ID:comp>``
``1`` if the CMake-id of the CXX compiler matches ``comp``, otherwise ``0``.
-``$<VERSION_GREATER:v1,v2>``
- ``1`` if ``v1`` is a version greater than ``v2``, else ``0``.
``$<VERSION_LESS:v1,v2>``
``1`` if ``v1`` is a version less than ``v2``, else ``0``.
+``$<VERSION_GREATER:v1,v2>``
+ ``1`` if ``v1`` is a version greater than ``v2``, else ``0``.
``$<VERSION_EQUAL:v1,v2>``
``1`` if ``v1`` is the same version as ``v2``, else ``0``.
+``$<VERSION_LESS_EQUAL:v1,v2>``
+ ``1`` if ``v1`` is a version less than or equal to ``v2``, else ``0``.
+``$<VERSION_GREATER_EQUAL:v1,v2>``
+ ``1`` if ``v1`` is a version greater than or equal to ``v2``, else ``0``.
``$<C_COMPILER_VERSION:ver>``
``1`` if the version of the C compiler matches ``ver``, otherwise ``0``.
``$<CXX_COMPILER_VERSION:ver>``
diff --git a/Help/release/dev/add-extra-boolean-comparisons.rst b/Help/release/dev/add-extra-boolean-comparisons.rst
new file mode 100644
index 0000000..a928994
--- /dev/null
+++ b/Help/release/dev/add-extra-boolean-comparisons.rst
@@ -0,0 +1,6 @@
+add-extra-boolean-comparisons
+-----------------------------
+
+* The :command:`if` command gained new boolean comparison operations
+ ``LESS_EQUAL``, ``GREATER_EQUAL``, ``STRLESS_EQUAL``, ``STRGREATER_EQUAL``,
+ ``VERSION_LESS_EQUAL``, and ``VERSION_GREATER_EQUAL``.
diff --git a/Help/variable/CMAKE_VERSION.rst b/Help/variable/CMAKE_VERSION.rst
index bbb1d91..872e2fa 100644
--- a/Help/variable/CMAKE_VERSION.rst
+++ b/Help/variable/CMAKE_VERSION.rst
@@ -26,11 +26,11 @@ Individual component values are also available in variables:
* :variable:`CMAKE_PATCH_VERSION`
* :variable:`CMAKE_TWEAK_VERSION`
-Use the :command:`if` command ``VERSION_LESS``, ``VERSION_EQUAL``, or
-``VERSION_GREATER`` operators to compare version string values against
-``CMAKE_VERSION`` using a component-wise test. Version component
-values may be 10 or larger so do not attempt to compare version
-strings as floating-point numbers.
+Use the :command:`if` command ``VERSION_LESS``, ``VERSION_GREATER``,
+``VERSION_EQUAL``, ``VERSION_LESS_EQUAL``, or ``VERSION_GREATER_EQUAL``
+operators to compare version string values against ``CMAKE_VERSION`` using a
+component-wise test. Version component values may be 10 or larger so do not
+attempt to compare version strings as floating-point numbers.
.. note::