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

Fernando Cacciola fernando.cacciola at gmail.com
Fri Feb 22 10:08:30 EST 2008


Sylvain Benner wrote:
>> 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.
>

OK, now I think about it, this expected.

> 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.
>
>
I just realized that I haven't really understood IF until now: it doesn't 
take a value as argument (like the IF of any other language I ever came 
across),  but a variable.

Best


-- 
Fernando Cacciola
SciSoft
http://fcacciola.50webs.com
http://groups.google.com/group/cppba





More information about the CMake mailing list