3

I have the source & objects for a third party library that I'm using in my code. The library comes with instructions on how to compile it using CMAKE to generate a make file that takes care of all of the dependencies. This make file creates two shared libraries libA.so and libB.so that are linked into my code stuff.cpp.

I would like to create a single library libstuff.so that contains inside it all the necessary information to run independently. Is there a way to do that without figuring out all the dependencies that go into building libA.so and libB.so? My last resort is to just by pass the CMAKE stuff and build my own Makefile by learning all the dependencies in the other project but I would like to avoid doing that if possible. (Not an expert in Make and never used CMake until now.)

Thanks in advance for your help.

Dess
  • 31
  • 1
  • 2

1 Answers1

0

You should simply build those libA.so and libB.so as static libraries (archives), i.e. libA.a and libB.a, and then link them into your own libstuff.so. If CMakeLists of this third party project does not provide you with an option to build them as static, then you'd have to modify it to add this option yourself, but that's relatively easy as long as you are not a complete novice in CMake.

Alexander Shukaev
  • 16,674
  • 8
  • 70
  • 85