[CMake] Combining several static libraries into a single static library
David Cole
dlrdave at aol.com
Wed Aug 6 06:19:30 EDT 2014
Seems like your best bet using CMake would be to use OBJECT libraries
for your Project01 through Project99 -- and then use STATIC libraries
for your ReleaseLibraries, which combine the objects of the appropriate
project libraries...
You may need to use dummy source files for the static libs, depending
on your build environment. See the Tests/ObjectLibrary/CMakeLists.txt
in the CMake source tree for an example of all the different
workarounds there are for older Visual Studios and Xcode...
http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/ObjectLibrary/CMakeLists.txt;h=0aeefaa48753feec0c5e0af2f850b32d6cd28279;hb=55d6aa36a522f2dd7849ccd53d9e743a88f8c7a1
Another alternative would be to use STATIC libraries all the way
through and let CMake do its transitive linking thing via
target_link_libraries, but then your executables that link to them
would need access to all of the static libraries including the
Project01 to Project99 ones, even at the very client level where you
are no doubt trying to simplify the build experience for those that
require your release libraries. Good luck!
HTH,
David C.
More information about the CMake
mailing list