[cmake-developers] [PATCH] remove "x" placeholder from STREQUAL operands

Jiri Malak malak.jiri at gmail.com
Sun Apr 13 03:59:03 EDT 2014


>> I enclosed patch for removing placeholder "x" from STREQUAL operands.
>> It does comparision transparent.
>
> I very much would like to see that, but there is a problem: CMake may
> interpret the operands of STREQUAL both as text and as variable name.
>
> So this does what you expect for the moment:
>
> if (${CMAKE_SYSTEM_NAME} STREQUAL Linux) ...
>
> But now you will get into trouble:
>
> set(Linux Windows)
>
> Sadly the expression is even expanded when it is quoted as long as it is a
> valid variable name. So what you could do is: replace the "x" by a simple
> space and then quote the match string, because " Linux" is no valid variable
> name. And the test for STREQUAL "x" can indeed be changed to STREQUAL "".
>
> Eike

Sorry, I am new for CMake script.
Is it also true for quoted operands?

Jiri




More information about the cmake-developers mailing list