Hi Aaron, If I run your script (using CMake 2.6.2) I get
-- CONTAINS_LIB = TRUE as output. Isn't that what you expected? If not, then I'm missing the point of your macro LIST_CONTAINS. What version of CMake are you using? Best regards, Marcel Loose. On Wed, 2009-11-18 at 09:54 -0800, aaron_wri...@selinc.com wrote: > I have a little question about how to prevent double substitution in > an IF statement. > > Consider this macro that looks through a list for a string, and sets a > variable to TRUE if it is found. The problem I have is that the IF > statement substitutes ${VALUE2} with LIB, and then substitutes LIB > with HELLO, and finds what it's looking for, even though it wasn't > really there. I want it to stop at the first substitution to prevent > this weird behavior. Ideas? > > MACRO(LIST_CONTAINS VAR VALUE) > SET(${VAR}) > > FOREACH(VALUE2 ${ARGN}) > IF(${VALUE} STREQUAL ${VALUE2}) > SET(${VAR} TRUE) > ENDIF() > ENDFOREACH() > ENDMACRO() > > SET(LIB HELLO) > SET(LIBS LIB IS GREAT) > > LIST_CONTAINS(CONTAINS_LIB ${LIB} ${LIBS}) > > MESSAGE(STATUS "CONTAINS_LIB = ${CONTAINS_LIB}") > --------------------------------------------------------- > Aaron Wright > Software Engineer - DCS Group > Schweitzer Engineering Laboratories, Inc. > Pullman, WA 99163 > 509-334-8087 > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake