[CMake] Re: IF( ${VAR} ) behaviour

Sylvain Benner benner at virtools.com
Fri Feb 22 09:03:11 EST 2008


>
>
> Now, why didn't
>
> if ( $ENV{SOME_ENV_VAR} )
>
> work?
>

Because $ENV{SOME_ENV_VAR} has the same behavior as ${SOME_ENV_VAR}, it 
evaluates a variable. The only difference is that ${} is a CMake 
variable and $ENV{} is an operating system environment variable.

I assume that IF statement only scan for CMake variables so you must do 
like you did: turn the environment variable into a CMake variable to 
make the conditional statement work.

--Sylvain


More information about the CMake mailing list