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

Hendrik Sattler post at hendrik-sattler.de
Thu Sep 4 12:40:49 EDT 2014



On 4. September 2014 16:38:21 MESZ, Ruslan Baratov via CMake <cmake at cmake.org> wrote:
>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()

I really do not understand this argument.
Do you have so little control over your build tool (and that's what CMake is)?
Nobody makes variables like this. Maybe to break the build script on purpose. And then, it breaks, so what?

HS



More information about the CMake mailing list