[cmake-developers] if (FOO == BAR) ...

Matthew Woehlke matthew.woehlke at kitware.com
Wed Mar 20 17:28:12 EDT 2013


On 2013-03-20 17:10, David Cole wrote:
> Are you proposing that == behaves as STREQUAL, or as EQUAL?

What's the difference?

Okay, for <, >, there is an obvious answer, but for ==, I am trying and 
failing to think of a situation where treating the arguments as numbers 
would give a different result vs. treating them as strings.

> given that I already know how these things work with if(VARIABLE
> constructs, I would expect that same thing from this new syntax.
> i.e. if(VAR == 5) works just like if(${VAR} == 5)

This I think I would expect also. What I would expect to be different 
from STREQUAL is that 'if("${var}" ==' is NOT the same as 'if(${var} =='.

> - it doesn't need a policy, existing behaviour doesn't change
>
> Agreed. (Unless you still expect the if(VAR behavior as you have with the other operators.)

On the other hand, I would probably be in favor of a policy to inhibit 
automatic variable expansion of a quoted string... and of making "don't 
do that" the default behavior, as it is hard to imagine when the current 
behavior would *ever* be desired.

-- 
Matthew




More information about the cmake-developers mailing list