Problem: CMake build uses library version as the ABI version

Solution: set SOVERSION in CMakeLists to match the SONAME generated
by libtool so that there is no mismatch between the output of the
*NIX build systems.

Before:
$ ls -l
total 2696
lrwxrwxrwx 1 luca luca      15 Dec  1 22:36 libzmq.so -> libzmq.so.4.2.0
lrwxrwxrwx 1 luca luca      15 Dec  1 22:36 libzmq.so.4.2.0 -> libzmq.so.4.2.1
-rwxr-xr-x 1 luca luca  906168 Dec  1 22:36 libzmq.so.4.2.1
$ readelf -d libzmq.so.4.2.1 | grep SONAME
 0x000000000000000e (SONAME)    Library soname: [libzmq.so.4.2.0]

After:
$ ls -l
total 2700
lrwxrwxrwx 1 luca luca      15 Dec  1 22:31 libzmq.so -> libzmq.so.5.1.0
-rwxr-xr-x 1 luca luca  906168 Dec  1 22:31 libzmq.so.4.2.1
lrwxrwxrwx 1 luca luca      15 Dec  1 22:31 libzmq.so.5.1.0 -> libzmq.so.4.2.1
$ readelf -d libzmq.so.4.2.1 | grep SONAME
 0x000000000000000e (SONAME)    Library soname: [libzmq.so.5.1.0]
This commit is contained in:
Luca Boccassi 2016-12-01 22:33:43 +00:00
parent febf801584
commit abeaba1557

View File

@ -733,11 +733,12 @@ if (MSVC)
OUTPUT_NAME "libzmq-static")
else ()
add_library (libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig})
# NOTE: the SOVERSION MUST be the same as the one generated by libtool!
set_target_properties (libzmq PROPERTIES
COMPILE_DEFINITIONS "DLL_EXPORT"
PUBLIC_HEADER "${public_headers}"
VERSION ${ZMQ_VERSION}
SOVERSION "${ZMQ_VERSION_MAJOR}.${ZMQ_VERSION_MINOR}.0"
SOVERSION "5.1.0"
OUTPUT_NAME "libzmq"
PREFIX "")
if (ZMQ_BUILD_FRAMEWORK)