[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 08:48:14 EDT 2014


>  Command `if(a MATCHES ...)` has the same flaw: `if(<variable|string>
> MATCHES regex)`:
> ..
> set(MYSTRING "B")
> set(A "MYSTRING")
> if("${A}" MATCHES "^MYSTRING$")
>   # do *not* go here even A is MYSTRING (use *variable* MYSTRING)
> endif()
>

This should work without dereferencing A, i.e.:

if(A MATCHES "^MYSTRING$")
  # Bingo
endif()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140904/a7ffd2ed/attachment.html>


More information about the CMake mailing list