Skip to content

cmake build decreases the compatibility_version of the shared libraries vs autotools build #130

@nieder

Description

@nieder

On macOS, the old autotools release (tested with 0.13.62) creates the library libzzip-0.13.dylib with a compatibility_version of 14.0.0. But the cmake build (tested with 0.13.72) has a compatibility_version of 13.0.0. This means that anything linked against 0.13.62 will fail if zziplib is upgraded to 0.13.72 because the compat_version decreased.

Setting MACHO_COMPATIBILITY_VERSION to 14.0.0 will fix this (or higher if new interfaces have been added between 0.13.62 and 0.13.72). This change does not affect the install_name (SOVERSION) of the library. And if the install_name for the libraries is ever increased, you can remove setting MACHO_COMPATIBILITY_VERSION because then SOVERSION will take precedence and it will a new one that autotools never saw.

https://cmake.org/cmake/help/git-stage/prop_tgt/MACHO_COMPATIBILITY_VERSION.html

Sample code change in zzip/CMakeLists.txt (but needs to be done for the 4 libraries)

 set_target_properties(libzzip PROPERTIES OUTPUT_NAME "zzip" RELEASE_POSTFIX "-${RELNUM}")
-SET_TARGET_PROPERTIES(libzzip PROPERTIES VERSION ${VERNUM}.${FIXNUM} SOVERSION ${VERNUM})
+SET_TARGET_PROPERTIES(libzzip PROPERTIES VERSION ${VERNUM}.${FIXNUM} SOVERSION ${VERNUM} MACHO_COMPATIBILITY_VERSION 14.0.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions