[Cmake] cmake bug with IF statement and end-of-line comment

Wheeler, Fred (Research) wheeler at crd.ge.com
Wed May 22 08:08:32 EDT 2002


I have found a most frustrating bug in cmake's interpretation of cmakelists.txt files.  When placed
in a cmakelists.txt file, the output of the following is only one line, the following ...

2 TEST_BUG true, 2nd line

I'm using the cvs source from 2002-05-19 7:00.  It seems that the presence of the comment causes the
IF statement to be true instead of false, and for the 1st line in the IF body to be skipped.  I have
no idea how to fix this.  The cmake manual does not really specify the syntax of a comment.  I assume
it is the intention that comments like the one below are acceptable.

OPTION(TEST_BUG "Bug demo?" NO)
IF(TEST_BUG)
  MESSAGE("1 TEST_BUG true")
  MESSAGE("1 TEST_BUG true, 2nd line")
ENDIF(TEST_BUG)
IF(TEST_BUG) # comment
  MESSAGE("2 TEST_BUG true")
  MESSAGE("2 TEST_BUG true, 2nd line")
ENDIF(TEST_BUG)


--
Fred Wheeler, GE CRD, KWC-303
Phone: 518-387-7225 (GE Internal Dialcom: 8*833-7225)
Fax:   518-387-4042 (GE Internal Dialcom: 8*833-4042)



More information about the CMake mailing list