[CMake] Which variable stores all (sub) directories added sofar?

Eric Noulard eric.noulard at gmail.com
Thu May 19 08:05:29 EDT 2011


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


More information about the CMake mailing list