[CMake] Explanation....

Johannes Zarl johannes.zarl at jku.at
Mon Apr 14 06:03:16 EDT 2014


Hello Theo,

On Friday, 11. April 2014, 14:20:36, Theodore Papadopoulo wrote:
> ::-B-::  <- This shows that B is indeed parsed as OPTIONAL
> 
> A
> A        <- Fine I'm in the else part of the if
> OPTIONAL
> HERE     <- Fine.

... I guess "OPTIONAL" should read "TOTO". You say it's fine, but it's 
probably not what you expected.

Let's take this step by step:

if ("${arg}" STREQUAL "TOTO")
-> if ("TOTO" STREQUAL "TOTO")
-> if (B STREQUAL B)

So, the expression evaluates to true.

> B
> HERE     <- ???????

Now this should not come as a surprise:

if ("${arg}" STREQUAL "TOTO")
-> if ("B" STREQUAL "TOTO")
-> if ( B STREQUAL B)

You could add a prefix to your if expression (I'm sure you have seen this 
technique in configure scripts*g*):

if ( "_ASDF_${arg}" STREQUAL "_ASDF_TOTO")

HTH,
  Johannes


P.S.: To get better visibility on mailing lists, it's best if you start a new 
thread instead of just replying to a message and changing the subject line.




More information about the CMake mailing list