[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 02:00:46 EDT 2014


> But is there a way to check if the value of the variable a equals to "b"
or "c"?

Directly:
if(a STREQUAL "b" OR a STREQUAL "c")

But its a bit clumsy.  Better would be to match a regex:
if(a MATCHES "^(b|c)$")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140904/295e0ea5/attachment.html>


More information about the CMake mailing list