<font size=2 face="sans-serif">I have a little question about how to prevent
double substitution in an IF statement.</font>
<br>
<br><font size=2 face="sans-serif">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?</font>
<br>
<br><font size=2>MACRO(LIST_CONTAINS VAR VALUE)</font>
<br><font size=2> SET(${VAR})</font>
<br>
<br><font size=2> FOREACH(VALUE2 ${ARGN})</font>
<br><font size=2>
IF(${VALUE} STREQUAL ${VALUE2})</font>
<br><font size=2>
SET(${VAR} TRUE)</font>
<br><font size=2>
ENDIF()</font>
<br><font size=2> ENDFOREACH()</font>
<br><font size=2>ENDMACRO()</font>
<br>
<br><font size=2>SET(LIB HELLO)</font>
<br><font size=2>SET(LIBS LIB IS GREAT)</font>
<br>
<br><font size=2>LIST_CONTAINS(CONTAINS_LIB ${LIB} ${LIBS})</font>
<br>
<br><font size=2>MESSAGE(STATUS "CONTAINS_LIB = ${CONTAINS_LIB}")</font>
<br><font size=2 face="sans-serif">---------------------------------------------------------<br>
Aaron Wright<br>
Software Engineer - DCS Group<br>
Schweitzer Engineering Laboratories, Inc.<br>
Pullman, WA 99163<br>
509-334-8087</font>