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
)
What I've done is to use the INCLUDE() function. This will work with older
versions of CMake that don't have the newer GET_DIRECTORY_PROPERTY functionality.
INCLUDE(subdir/CMakeLists.txt) or
INCLUDE(subdir/sources.cmake)
Inside these directories paths are relative to the CMakeLists.txt file that
included it.
sources.cmake :
SET(MY_SOURCES
subdir/Source.cc
subdir/Source2.cc
subdir/Source3.cc
)
James
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake