[CMake] set(a b); set(b c); if(a STREQUAL b OR a STREQUAL c) ...

Chuck Atkins chuck.atkins at kitware.com
Thu Sep 4 01:36:23 EDT 2014


Hi Clark

The expression inside the if statement has it's variables dereferenced
before evaluating and the non-variables are treated as constant
expressions.  In this case, a resolves to "b", b resolves to "c", and c is
not a variable so it's treated as the constant expression "c".  Thus

if(a STREQUAL b OR a STREQUAL c)

gets evaluated as

if( ("b" STREQUAL "c") OR ("b" STREQUAL "c") )

which is clearly false.  Hope that helps.

- Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140904/66eedfed/attachment.html>


More information about the CMake mailing list