mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-20 06:00:30 -06:00
The wording update in commit b74819e4fe (Help: Format 'if' command
documentation, 2013-12-18, v3.0.0-rc1~227^2~1) incorrectly implied that
`AND` has higher precedence than `OR`. Although this is common in many
languages, it has never been true in CMake's implementation. Revise
the wording to clarify the precedence.
Add a test case demonstrating the order.
Fixes: #23207
7 lines
228 B
CMake
7 lines
228 B
CMake
# AND and OR are the same precedence
|
|
if(1 OR 0 AND 0) # equivalent to ((1 OR 0) AND 0)
|
|
message(FATAL_ERROR "AND incorrectly evaluated before OR")
|
|
else()
|
|
message(STATUS "OR and AND correctly evaluated left to right")
|
|
endif()
|