Combining third-party static libraries into a stand-alone static library with cmake?

So, I have, say, libA.a libB.a libC.a libD.so and some code that is related to libPack.a . Later I will create libFinal.so that will reference libPack.a, and libFinal.so will finally be used in the executable.

When the linker creates a static library, I believe that every dynamic library is enabled and enabled at compile time in the static library. Does it also for ( -fPIC ) third-party static libraries?

How can I combine a bunch of static libraries and shared libraries into one huge stand-alone libFinal.so library using CMake? If this is not possible, does this mean that I should provide all the lib dependencies on the client?

I managed to get the executable to work with a dummy library without dependencies (without libA...D ), but I get undefined characters for third-party libraries when I use libPack.a associated with libA..D . I assume that static libraries are not being sent to libPack.a , but I'm not sure what is happening.

+4
source share
1 answer

The following answers may be useful: How to combine several C / C ++ libraries into one? Combine several shared libraries.

If this suits your needs, you can configure the CMake script to add a pre-build event to the project that combines the libraries in libFinal.so and the subsequent link libFinal.so to the executable.

0
source

All Articles