Skip to content

while: Restore tolerance of condition error

Alex Turbov requested to merge zaufi/cmake:bug/22524 into master

Since !6442 (merged) we correctly reject the code

set(paren "(")
while(${paren})
endwhile()

However, rejecting it breaks compatibility with projects that used such code accidentally. In CMake 3.21 and below, any error in the condition was ignored because the false result exited the loop first. Restore tolerance of the error for now. A policy will be needed to make it an error later.

Note that the same condition with if was always correctly rejected.

Fixes: #22524 (closed)
Issue: #23296 (closed)
Backport: release
Topic-rename: while-bug-compatibility

Edited by Brad King

Merge request reports