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

Mehdi Rabah mehdi.rabah at gmail.com
Mon Feb 25 10:16:08 EST 2008


Hi,

Me and a work friend ran into the same problem a few days ago. May I suggest
to the admins to add a little note in the IF doc about this common mistake ?

Regards,
--
Mehdi

On Fri, Feb 22, 2008 at 4:08 PM, Fernando Cacciola <
fernando.cacciola at gmail.com> wrote:

> 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
>
>
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20080225/940a05e6/attachment.html


More information about the CMake mailing list