[CMake] communicat variables from sub directories

Axel Roebel Axel.Roebel at ircam.fr
Thu Apr 6 14:26:02 EDT 2006


On Thursday 06 April 2006 16:42, Brad King wrote:
> Axel Roebel wrote:
> > Hello,
> >
> > I am trying to collect source file lists from sub directories
> > into the main cmake cache.
> >
> > The idea is that the main directory gets a collection of all source files
> > and header files such that it may run a doxygen whenever one of these
> > files has changed.
> >
> > Imagine
> >
> > SET(DOCFILES "" CACHE INTERNAL "list of all files containing doc")
> > ADD_SUBDIRECTORY(src )
> > ADD_SUBDIRECTORY(include)
> >
> > and in each subdir I tried various versions like
> >
> > SET(DOCFILES ${DOCFILES}${LISTOFSRCS} )
> >
> > or what I considered more likely to be correct
> >
> > SET(DOCFILES ${DOCFILES}${LISTOFSRCS} CACHE INTERNAL "list of all files
> > containing doc")
> >
> >
> > This gives me a correct list of files in the subdirectory
> > but the variable in the main directory is not changed.
> >
> > For now I found that  I need to create a new cache variable in the
> > sub directories to be able to read the content of that variable in the
> > main directory so that's what I do now.
> >
> > Does anybody know how to make that work with a more elegant
> > solution ?
>
> See "bin/cmake --help-command GET_DIRECTORY_PROPERTY".
>
> GET_DIRECTORY_PROPERTY(
>    subdir_SOMEVAR DIRECTORY subdir DEFINITION SOMEVAR
> )

Thanks Brad,

this is really much nicer.

Axel

> -Brad
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

-- 
Axel Roebel    
IRCAM Analysis/Synthesis Team
Email: Axel.Roebel at ircam.fr | Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540


More information about the CMake mailing list