Any suggestions on how to organise that? Presumably there are lots of examples in (for example) KDE, but I'm not familiar enough with that codebase to be able to find them easily.
Currently our GNU Make build builds static libraries in the subdirectories, then those are put into a big static library and that's linked into a shared library. (The last step uses a shell script which knows how to do that for various platforms.) My first attempt uses add_library(... OBJECT ...) in the subdirectories, then add_library(... SHARED $<TARGET_OBJECTS:...> $<TARGET_OBJECTS:...>) to combine them. That works, though it means repeating the same information (more or less) twice since for each add_subdirectory() there'll be a $<TARGET_OBJECTS:>. Also the dependent libraries need to be added in the top-level but they're triggered by the subdirectory (by the looks of it I can't use target_link_libraries() on an OBJECT library). It works, though, and didn't take me very long to do, and the result looks clean and relatively easy to follow. Any better ways to do this? (In the particular case I'm looking at, splitting the libraries and just having one per subdirectory might make sense, but not in all cases.)
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake