[CMake] IF( ${VAR} ) behaviour
Sylvain Benner
benner at virtools.com
Fri Feb 22 08:41:52 EST 2008
Fernando Cacciola a écrit :
> Hi people,
>
> Consider the following (tested in 2.4.7):
>
> set ( VAR "whatever" )
>
> message( STATUS "VAR=${VAR}" )
>
> if ( ${VAR} )
> message( STATUS "VAR evaluates to true" )
> else ( ${VAR} )
> message( STATUS "VAR evaluates to false" )
> endif( ${VAR} )
>
>
> it prints "VAR evaluates to false".
>
> Is that expected?? The documentation of IF() doesn't match this
> behaviour AFAICS.
>
> TIA
>
>
Hi,
You should use IF(VAR) instead.
In your example you made the test : IF(whatever)
"whatever" variable does not exist so the evaluation is false.
--Sylvain
More information about the CMake
mailing list