while(TRUE) doesn't warn where if(TRUE) would
Consider this CMakeLists.txt:
cmake_minimum_required(VERSION 2.6)
while(TRUE)
message(STATUS "While true")
break()
endwhile()
if(TRUE)
message(STATUS "If true")
endif()
This uses the old, and deprecated, setting for policy CMP0012. That means that TRUE isn't recognized as a Boolean truthy value, and so neither the while, nor the if, block is entered. Output is (after the language checking):
CMake Warning (dev) at CMakeLists.txt:6 (if):
if given arguments:
"TRUE"
An argument named "TRUE" appears in a conditional statement. Policy
CMP0012 is not set: if() recognizes numbers and boolean constants. Run
"cmake --help-policy CMP0012" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
This warning is for project developers. Use -Wno-dev to suppress it.
The while doesn't trigger this warning, although the if does -- even though both are evaluating boolean contexts. That's a very minor inconsistency.