[cmake-developers] while(1) containing non-fatal errors is an infinite loop
Brad King
brad.king at kitware.com
Fri Dec 6 09:46:22 EST 2013
On 12/05/2013 03:39 PM, Alan W. Irwin wrote:
> But if you replace
>
> message(FATAL_ERROR "Should stop loop?") ==>
> add_subdirectory(non_existent_directory)
Okay, so the code in question is:
while(1)
add_subdirectory(non_existent_directory)
message(STATUS "Did I make it by FATAL_ERROR?")
endwhile(1)
> in the above CMake logic you get an infinite loop despite the FATAL
> error from the add_subdirectory command.
A missing subdirectory is not a FATAL error. Your example is similar to
while(1)
message(SEND_ERROR "This is not a fatal error")
message(STATUS "I made it past SEND_ERROR as docs state")
endwhile()
which is clearly an infinite loop. Any number of non-fatal errors
could occur inside a loop and not affect the loop termination.
-Brad
More information about the cmake-developers
mailing list