if: Documentation incorrectly implies AND binds before OR
The boolean operator AND should be evaluated before OR, but the following incorrectly prints "FALSE":
cmake_minimum_required(VERSION 3.22)
if(YES OR NO AND NO)
message("TRUE")
else()
message("FALSE") # branch taken
endif()
This bug doesn't occur when evaluating variables:
cmake_minimum_required(VERSION 3.22)
set (X YES)
set (Y NO)
if(X OR Y AND Y)
message("TRUE") # branch taken
else()
message("FALSE")
endif()
Edited by Brad King