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

Bill Hoffman bill.hoffman at kitware.com
Wed May 22 09:49:22 EDT 2002


It used to be that the comments had to be on a separate line, and it
was not documented.  However, I have just changed that, and now you 
can have comments anywhere.

In all previous versions of cmake, putting comments in the middle of 
a line caused unpredictable results.

-Bill


At 08:08 AM 5/22/2002 -0400, Wheeler, Fred (Research) wrote:

>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)
>_______________________________________________
>Cmake mailing list
>Cmake at public.kitware.com
>http://public.kitware.com/mailman/listinfo/cmake 




More information about the CMake mailing list