[CMake] build a shared library from static libraries

Alexander Neundorf a.neundorf-work at gmx.net
Mon Mar 3 19:16:19 EST 2008


On Monday 03 March 2008, packadal wrote:
> Hi
> I am trying to build a shared library from many static libs, so I can
> divide my compilation in subdirectories.

Don't do that, just use directly the source files from the subdirectories.

> But I don't get how i should do this.
> I tried to use TARGET_LINK_LIBRARY( first_lib, second_lib, ...)
> But cmake says : " Attempt to add link library "first_lib", to target
> "second_lib", which is not built by this project."
> Is there a better way to di this ?

Did you use SUBDIRS() ? Use ADD_SUBDIRECTORY() instead, then the dirs will be 
processed at the time of the call, with SUBDIRS the dirs are processed at the 
end of the CMakeLists.txt

Alex


More information about the CMake mailing list