[Cmake] CMake bug: Nested identical IF statements

Wheeler, Fred (Research) wheeler at crd.ge.com
Mon Aug 26 14:00:48 EDT 2002


If I put the following in a CMakeLists.txt file,

SET( X "NO" )
IF( X )
MESSAGE( "INSIDE OUTER, BEFORE INNER" )
IF( X )
MESSAGE( "INSIDE OUTER, INSIDE INNER" )
ENDIF( X )
MESSAGE( "INSIDE OUTER, AFTER INNER" )
ENDIF( X )

I would not expect any of the three messages to get printed.  But, the third message does get
printed.  This is the output,

INSIDE OUTER, AFTER INNER

It is as if the first ENDIF( X ) terminates both IF( X ) conditionals.

When X is set to "YES", all three messages get printed, as expected.

I have not experimented with the effect on ELSE clauses.

My cmake executable prints that it is version 1.4, but I'm certain it is version 1.4.3, build from
the source in Cygwin.

Fred Wheeler



More information about the CMake mailing list