[CMake] Merging libraries (equivalent of autotools' "convenience libraries")

Brad King brad.king at kitware.com
Thu Oct 28 07:29:47 EDT 2004


Alex Brooks wrote:

> Hi,
> 
> I'm in the process of converting a sizeable project from using GNU
> autotools to cmake.  The autotools version builds object code in several
> libraries, creates a (libtool) convenience library in each directory,
> then right at the end of the build it merges the lot into one shared
> library.  
> 
> This keeps the entire project fairly modular (different directories
> don't have to know about each others' contents), but lets people link
> against the single merged library with one '-lWholeShebang' or similar.
> 
> I haven't been able to work out how to get similar behaviour using
> cmake.  I wonder if anyone can help?

There are a couple possibilities.  You can add a custom target with a 
custom command that links the multiple libraries into a single library. 
  If you can figure out how to do this on all platforms, please post the 
solution.

Alternatively you can add the object files to the final library as 
source files and it will link them all together.

-Brad



More information about the CMake mailing list