Hello, On 2/25/08, packadal <[EMAIL PROTECTED]> wrote: > Hi, I searched for an answer to this question in vain, so I'm asking here. > > I am trying to build a library wich is spead among many subdirectories using > CMake, but I can't seem to do it "the Right Way". > > Looks like the right way to do this would be to write a CMakeLists.txt in > each subdirectory, as this would be cleaner, and much more changes-friendly, > but I can't seem to build only one library when I do it this way. > > example of my source tree : > > + src > | - Application > | - Attributes > | - Audio > . > . > . > | - Utils > > Each directory containing multiple source files for the lib. > I managed to build the library, putting each and every file in a single > variable in one file, but this is looking quite ugly... > > So how should i do please ? Here is how I would proceed. First I assume that you compile all .c files in each sub directories, then I suppose you have many many files to compile.
AUX_SOURCE_DIRECTORY (Applications APPLICATIONS_SRC) AUX_SOURCE_DIRECTORY (Attributes ATTRIBUTES_SRC) ... AUX_SOURCE_DIRECTORY (Utils UTILS_SRC) LIST (APPEND FULL_SRC ${APPLICATIONS_SRC} ${ATTRIBUTES_SRC} ... ${UTILS_SRC} ) ADD_LIBRARY (my_lib ${FULL_SRC}) > > Thanks in advance > > P.S. : excuse the poor English, as i'ts not my mother tongue :) > > -- > - Always keep in mind that you may be wrong - > _______________________________________________ > CMake mailing list > CMake@cmake.org > http://www.cmake.org/mailman/listinfo/cmake > -- Olivier DOLE Pleyo Software Engineer _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake