[CMake] Re: function and raise_scope commands

Alexander Neundorf a.neundorf-work at gmx.net
Sat Feb 16 14:13:38 EST 2008


On Saturday 16 February 2008, Alexander Neundorf wrote:
> On Saturday 16 February 2008, Bill Hoffman wrote:
> > Alexander Neundorf wrote:
> > > On Friday 18 January 2008, Alexander Neundorf wrote:
>
> ...
>
> > >> set(foo a b c PARENT_SCOPE)
> > >>
> > >> I'm not sure it is a good idea that this also propagates to the parent
> > >> directory. What is a use case for this ?
> > >
> > > What do you think about this ?
> > > I think it's no good idea. Until now you can rely on that whatever
> > > happens in subdirectories doesn't modify variables in the parent
> > > directory (the only way is to force something through the cache, which
> > > is a bit ugly).
> > > If you need to get information from a subdir to some other place, with
> > > cmake 2.6 you can use a global property to do this, which will also
> > > work over multiple levels of subdirectories. Doing this using
> > > PARENT_SCOPE would require to build a chain of these calls through all
> > > directories, which I think is not very nice and can require relatively
> > > much code.
> > >
> > > Do you have objections to removing that feature (propagating to the
> > > parent directory) ?
> >
> > I am pretty sure raise_scope was removed in favor of this version of
> > set, so if you remove it, there will be no way to raise scope...
>
> I don't mean to remove the SET(PARENT_SCOPE) feature, where the main
> purpose is to set a global variable from within a function.
> But if SET( ... PARENT_SCOPE) is called outside a function, the effect is
> that the variable is set in the parent directory. This is the part where
> I'm not sure it's a good idea.

...this would be the patch, with the patch PARENT_SCOPE only raises the scope 
out of a function, but not to the parent directory anymore.

Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: raisescope.patch
Type: text/x-diff
Size: 842 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20080216/9a7f0248/raisescope.bin


More information about the CMake mailing list