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

Ruslan Baratov ruslan_baratov at yahoo.com
Thu Sep 4 10:38:21 EDT 2014


On 04-Sep-14 18:09, Anders Lindgren wrote:
> make sure that the argument don't form a valid variable name.
It's not possible

>
>     set(a b)
>     set(b c)
>     if(">${a}<" STREQUAL ">b<" OR ">${a}<" STREQUAL ">c<")
>       message("true")
>     endif()
How about that:

set(a "") # variable `a` is empty
set("><" ">b<")

if(">${a}<" STREQUAL ">b<")
   message("Value of variable with name `a` is `b`!")
endif()


More information about the CMake mailing list