Here is the original thread - Ken http://public.kitware.com/pipermail/cmake/2006-December/012257.html
Ken Martin PhD Kitware Inc. 28 Corporate Drive Clifton Park NY 12065 518 371 3971 -----Original Message----- From: wedekind [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 06, 2007 10:45 AM To: Ken Martin; cmake@cmake.org Subject: AW: [CMake] Strange problem with parsing variables Hi Ken, thanks for your reply. Though I'm reading this list quite regularly I have missed this fix :( Cheers Marco >-----Ursprüngliche Nachricht----- >Von: Ken Martin [mailto:[EMAIL PROTECTED] >Gesendet: Dienstag, 6. Februar 2007 16:42 >An: 'wedekind'; cmake@cmake.org >Betreff: RE: [CMake] Strange problem with parsing variables > >This was fixed in CVS CMake a couple weeks ago. I sent out an email >describing the issue to the list in response to a similar (or the same) >problem. > >Thanks >Ken > >Ken Martin PhD >Kitware Inc. >28 Corporate Drive >Clifton Park NY 12065 >518 371 3971 > >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of >wedekind >Sent: Tuesday, February 06, 2007 9:08 AM >To: cmake@cmake.org >Subject: AW: [CMake] Strange problem with parsing variables > >Hello all, > >I just want to revive my topic from two weeks ago. Please have a look at >the mail below. Can you reproduce this behaviour? What's the reason behind >it or is it a bug? > >Cheers > >Marco > >>>-----Ursprüngliche Nachricht----- >>>Von: wedekind [mailto:[EMAIL PROTECTED] >>>Gesendet: Freitag, 26. Januar 2007 17:02 >>>An: 'cmake@cmake.org' >>>Betreff: [CMake] Strange problem with parsing variables >>> >>>Hello all, >>> >>>I've encountered a strange parsing problem with a 2-month old checkout >>from >>>CMake's cvs repository. Please have a look at the following sample >>>CMakeLists.txt: >>> >>>SET(SOME_VAR 1) >>> >>>IF(SOME_VAR) >>> MESSAGE("SOME_VAR is set to true") >>>ENDIF(SOME_VAR) >>> >>>IF(NOT SOME_VAR) >>> SET(SOME_OTHER_VAR some_value) >>> MESSAGE("SOME_VAR set to false") >>> IF(some_value STREQUAL ${SOME_OTHER_VAR}) >>> MESSAGE("SOME_OTHER_VAR is set to some_value") >>> ENDIF(some_value STREQUAL ${SOME_OTHER_VAR}) >>>ENDIF(NOT SOME_VAR) >>> >>>When running cmake on it, cmake throws an error like this: >>> >>>CMakeLists.txt:10: >>>IF had incorrect arguments: some_value STREQUAL ${SOME_OTHER_VAR} >(Unknown >>>arguments specified). >>> >>>I guess, what happens is, that cmake does not know about any variables >>>defined in the second IF (IF(NOT SOME_VAR)...), i.e. SOME_OTHER_VAR is >not >>>known to cmake's parser. But it complains about this "missing" variable >>>because it is used in another IF-statement (IF(some_value STREQUAL >>>${SOME_OTHER_VAR})...). This is strange, because cmake does not need to >>>parse the content of the second IF, if SOME_VAR is set to "1". Or it >>should >>>parse the variables too. >>> >>>If you define SOME_OTHER_VAR outside of the second IF, everything works >>>fine: >>> >>>SET(SOME_VAR 1) >>> >>>IF(SOME_VAR) >>> MESSAGE("SOME_VAR is set to true") >>>ENDIF(SOME_VAR) >>> >>>SET(SOME_OTHER_VAR some_value) >>> >>>IF(NOT SOME_VAR) >>> MESSAGE("SOME_VAR set to false") >>> IF(some_value STREQUAL ${SOME_OTHER_VAR}) >>> MESSAGE("SOME_OTHER_VAR is set to some_value") >>> ENDIF(some_value STREQUAL ${SOME_OTHER_VAR}) >>>ENDIF(NOT SOME_VAR) >>> >>>It also works, if you put the content of the second IF-statement into a >>>separate file, which is included in the second if: >>> >>>SET(SOME_VAR 1) >>> >>>IF(SOME_VAR) >>> MESSAGE("SOME_VAR is set to true") >>>ENDIF(SOME_VAR) >>> >>>IF(NOT SOME_VAR) >>> INCLUDE(include.cmake) >>>ENDIF(NOT SOME_VAR) >>> >>>include.cmake is: >>> >>>SET(SOME_OTHER_VAR some_value) >>>MESSAGE("SOME_VAR set to false") >>>IF(some_value STREQUAL ${SOME_OTHER_VAR}) >>> MESSAGE("SOME_OTHER_VAR is set to some_value") >>>ENDIF(some_value STREQUAL ${SOME_OTHER_VAR}) >>> >>>Why does cmake work this way? >>> >>>Cheers >>> >>>Marco > > > >_______________________________________________ >CMake mailing list >CMake@cmake.org >http://www.cmake.org/mailman/listinfo/cmake _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake