[CMake] Explanation....

Matthew Woehlke mw_triad at users.sourceforge.net
Mon Apr 28 12:48:40 EDT 2014


On 2014-04-28 04:58, Johannes Zarl wrote:
> I'm always happy to learn something new. How would you manage to make the
> following if statement trigger?
>
> set( arg "value")
> if (" ${arg}" STREQUAL " TOTO" )
>    message ( "arg equals 'TOTO', and arg equals 'value'" )
> endif()

Exactly how you would expect:

set(" TOTO" " value")

...and it does trigger:

   $ cmake -P evil.cmake
   arg equals 'TOTO', and arg equals 'value'

> No, but the if statement didn't trigger, either.

Well, yes, but that's because I caused arg to be compared against 'evil' 
instead of 'TOTO'. Since arg is set to 'value', it still didn't match. 
The previous "example" was more metaphorical.

-- 
Matthew



More information about the CMake mailing list