[CMake] Merge two static libraries

J Decker d3ck0r at gmail.com
Tue Oct 5 04:28:16 EDT 2010


On Tue, Oct 5, 2010 at 1:10 AM, pellegrini <pellegrini at ill.fr> wrote:
> Hello everybody,
>
> I have a library that can be built for a use in different modes (console,
> window). It is made of two sets of files. The first one is common to
> the console/window building modes while the second set has to be be built
> with a slightly different compiler flags depending on the selected
> building mode.
>
> After many discussions here, I was advised to build a static library  for
> the the files common to console and window building modes
> (e.g. common.a) and to build a second static library for the files depending
> on the building mode (e.g. console.a and window.a) linking the
> latter to the first one. I did it and ... it worked ! But what I would like
> is a little bit different. I would like my console.a (or window.a) library
> to
> contain the object files of the common.a library. Indeed something like 'ar
> cr console.a library.a'.
>

okay if you got it working that much, then making console.so or
window.dll is easy... just add SHARED to your add_library command...

I think you can get a .a target from two other .a's but it would be
console_linked_with_lib.a from conosole.a and library.a

> Would you have any idea ?
>
> thank you
>
> Eric
>
>
> --
> Eric Pellegrini
> Calcul Scientifique
> Institut Laue-Langevin
> Grenoble, France
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>


More information about the CMake mailing list