A simple starter project showing how to distribute both static and shared libraries in CMake.
The basic challenge is that CMake targets represent a single physical library, so there are a bunch of
competing standards for determining whether SomeLib::SomeLib
ought to be shared or static. In the
associated blog post, I develop this solution from three basic principles:
- The build interface should match the install interface.
- Only strict build requirements belong in CMakeLists.txt.
- A single project will not mix both shared and static versions of a library.
For the full story, click here: https://alexreinking.com/blog/building-a-dual-shared-and-static-library-with-cmake.html
If this example helps you with your work, consider saying thank you by buying me a coffee!