diff options
author | Brad King <brad.king@kitware.com> | 2022-02-10 14:11:07 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2022-02-10 14:11:13 (GMT) |
commit | cd71d7f6633ae1c091b21e4badf4bfaeae6d6fd4 (patch) | |
tree | 8774048b08ef125b0816a265c127f9c9a777d868 /Help | |
parent | 90a77c60b3d1fc4ee7da7eed264fbe6c9c877b29 (diff) | |
parent | 41adfc6b041474f6985ab72efcfb02b2b64a6b8d (diff) | |
download | CMake-cd71d7f6633ae1c091b21e4badf4bfaeae6d6fd4.zip CMake-cd71d7f6633ae1c091b21e4badf4bfaeae6d6fd4.tar.gz CMake-cd71d7f6633ae1c091b21e4badf4bfaeae6d6fd4.tar.bz2 |
Merge topic 'doc-if-AND-OR'
41adfc6b04 Help: Clarify precedence of AND and OR in 'if' conditions
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6970
Diffstat (limited to 'Help')
-rw-r--r-- | Help/command/if.rst | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst index a729b1e..4f955db 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -38,14 +38,21 @@ The following syntax applies to the ``condition`` argument of the ``if``, ``elseif`` and :command:`while` clauses. Compound conditions are evaluated in the following order of precedence: -Innermost parentheses are evaluated first. Next come unary tests such -as `EXISTS`_, `COMMAND`_, and `DEFINED`_. Then binary tests such as -`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`_. Then the boolean operators in the order `NOT`_, `AND`_, -and finally `OR`_. + +1. Parentheses. + +2. Unary tests such as `EXISTS`_, `COMMAND`_, and `DEFINED`_. + +3. Binary tests such as `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`_. + +4. Unary logical operator `NOT`_. + +5. Binary logical operators `AND`_ and `OR`_, from left to right, + without any short-circuit. Basic Expressions """"""""""""""""" |