[CMake] Which variable stores all (sub) directories added sofar?
Glenn Coombs
glenn.coombs at gmail.com
Thu May 19 12:06:46 EDT 2011
I think that you can use an environment variable rather than a normal
variable to bypass the normal scoping rules. So:
set(ENV{foo} "bar")
will I think allow other CMakeFiles to read it using:
$ENV{foo}
regardless of the sub-directory level. I haven't tried using this so it may
not work but I think it should do what you want.
--
Glenn
On 19 May 2011 13:05, Eric Noulard <eric.noulard at gmail.com> wrote:
> 2011/5/19 J.S. van Bethlehem <j.s.van.bethlehem at astro.rug.nl>:
> >
> > Hello Eike,
> >
> > Thanks a lot for your reply. I have actually been thinking in the same
> > direction. I have one problem though: how can you make a truly global
> > variable in CMake? Whenever you do something to a variable in a directory
> > that is added using add_subdirectory(), those changes don't propagate to
> the
> > current directory
> > (well, one could use the PARENT_SCOPE option to set() in the
> sub-directory,
> > but then I won't be able to test that sub-directory seperately because
> then
> > CMake will err that there is no such scope)
> >
> > How do you deal with this?
>
> I think, that's why Eike uses **property** and not variable.
>
> Property may be at "GLOBAL" scope:
>
> set_property(<GLOBAL |
> DIRECTORY [dir] |
> TARGET [target1 [target2 ...]] |
> SOURCE [src1 [src2 ...]] |
> TEST [test1 [test2 ...]] |
> CACHE [entry1 [entry2 ...]]>
> [APPEND]
> PROPERTY <name> [value1 [value2 ...]])
>
> Set one property on zero or more objects of a scope. The first
> argument determines the scope in which the property is set. It must
> be one of the following:
>
> GLOBAL scope is unique and does not accept a name.
> ...
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110519/fbd3d6d4/attachment.htm>
More information about the CMake
mailing list