[Cmake] Collecting files from subdirs

Nils H. Busch nilsb at cns.mpg.de
Thu Mar 27 12:42:31 EST 2003


Hi,

probably something very easy, but I can't get it to work.
I want to add source files from several subdirs in one cmake var to use
it in a call to
ADD_LIBRARY(somelib ${SRCS}).
This is to collect source files from several subdirs and make one
library out of it.
I have tried a few things, but my list is always empty.
Something like in a top-level CmakeLists.txt
SET(SRCS "")
SUBDIRS(dir1 dir 2)
and then in subdir CMakeLists.txt
SET(SRCS "${SRCS} foo")
does not work.

I'd like to retain the structure of those subdirs to organize code, but
combine it into one library.
Any hints?

Thanks.

--
    Nils H. Busch
    Max-Planck-Institute of Cognitive Neuroscience
    phone:  ++49 (341) 9940-035 fax:  ++49 (341) 9940-204
    e-mail: nilsb at cns.mpg.de






More information about the CMake mailing list