[cmake-developers] Shared libraries

Chuck Atkins chuck.atkins at kitware.com
Tue Aug 21 12:57:59 EDT 2018


Hi Tony,

I believe I somewhat misunderstood what appears to be two separate issues
here: 1: how to get your build to generate the static and shared libraries
and 2: the library format doesn't seem correct. Regarding 1, it will be
project specific if the project's build designed to simultaneously produce
multiple configurations. In the context of MongoC, I've looked at the CMake
files and it seems as though shared libraries are always built and static
libraries can *also* be explicitly enabled/disabled by setting
-DENABLE_STATIC=ON or -DENABLE_STATIC=OFF.

Regarding 2,

On AIX, when building MongoC 1.11, cmake 3.11.4 generates lib*.so files and
> lib*.a files which contain .o files.
>
> On AIX, we should get libraries lib*.a containing the lib*.so file.
>
>
While with most SysV and BSD unices the concept of "shared libraries" and
"runtime linking" are one in the same and go togethor, on AIX they are two
seperate ideas orthogonal to one another.  On AIX you can have shared
libraries used for runtime-linking, i.e. libfoo.so containing objects, and
archive files libfoo.a used for compile time linking.  The archive file can
then in turn contain object files used for static linkling or an so used
for shared linking.  CMake will produce the stand alone libfoo.so shared
lib for shared runtime linking and the libfoo.a archive with object files
for static compile-time linking, but I believe does not support generating
the libfoo.a archive with .sos for shared compile-time linking.

- Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20180821/655eb885/attachment.html>


More information about the cmake-developers mailing list