From dce6ea22fb575aaa4877c5d722cb7c651812d766 Mon Sep 17 00:00:00 2001 From: Guido Draheim Date: Sun, 16 Sep 2018 15:02:02 +0200 Subject: [PATCH] make an explicit ZZIPLIBTOOL compatibility flag to highlight the feature --- zzip/CMakeLists.txt | 20 ++++++++++++++++++-- zzipwrap/CMakeLists.txt | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt index aea8b6f..2cfa46e 100644 --- a/zzip/CMakeLists.txt +++ b/zzip/CMakeLists.txt @@ -16,6 +16,7 @@ option(MSVC_STATIC_RUNTIME "Build with static runtime libs (/MT)" ON) option(ZZIPMMAPPED "Build libzzipmmapped (not fully portable)" ON) option(ZZIPFSEEKO "Build libzzipfseeko (based on posix.1 api)" ON) option(ZZIPCOMPAT "Build compatibility with old libzzip releases" ON) +option(ZZIPLIBTOOL "Ensure binary compatibility with libtool" ON) if(ZZIPCOMPAT) @@ -265,14 +266,29 @@ if(ZZIPCOMPAT) cd $DESTDIR/${libdir} [ -f ${lib}${libname}${librelease}${dll}.${libversion} ] || exit 0 echo -n .. Installing: `pwd` - ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${dll} - echo -n .. Installing: `pwd` ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.10 echo -n .. Installing: `pwd` ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.11 echo -n .. Installing: `pwd` ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${librelease}${dll}.12 \")") + endif() +endif() + +if(ZZIPLIBTOOL) + if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG) + set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}) + set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + get_target_property(libname libzzip OUTPUT_NAME) + get_target_property(librelease libzzip RELEASE_POSTFIX) + get_target_property(libversion libzzip VERSION) + install(CODE "execute_process(COMMAND bash -c \"set -e + cd $DESTDIR/${libdir} + [ -f ${lib}${libname}${librelease}${dll}.${libversion} ] || exit 0 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${dll} + \")") get_target_property(libname libzzipfseeko OUTPUT_NAME) get_target_property(librelease libzzipfseeko RELEASE_POSTFIX) get_target_property(libversion libzzipfseeko VERSION) diff --git a/zzipwrap/CMakeLists.txt b/zzipwrap/CMakeLists.txt index 2e6835f..c4abbf9 100644 --- a/zzipwrap/CMakeLists.txt +++ b/zzipwrap/CMakeLists.txt @@ -10,6 +10,7 @@ option(BUILD_SHARED_LIBS "Build a shared library" ON) option(BUILD_STATIC_LIBS "Build the static library" OFF) option(BUILD_TESTS "Build test programs" OFF) option(MSVC_STATIC_RUNTIME "Build with static runtime libs (/MT)" ON) +option(ZZIPLIBTOOL "Ensure binary compatibility with libtool" ON) check_include_files ( unistd.h ZZIP_HAVE_UNISTD_H ) # set ( ZZIP_HAVE_ZLIB_H 1 ) @@ -71,3 +72,20 @@ install(FILES ${libzzipwrap_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/zzip ) install(TARGETS libzzipwrap LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +if(ZZIPLIBTOOL) + if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG) + set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}) + set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX}) + set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) + get_target_property(libname libzzipwrap OUTPUT_NAME) + get_target_property(librelease libzzipwrap RELEASE_POSTFIX) + get_target_property(libversion libzzipwrap VERSION) + install(CODE "execute_process(COMMAND bash -c \"set -e + cd $DESTDIR/${libdir} + [ -f ${lib}${libname}${librelease}${dll}.${libversion} ] || exit 0 + echo -n .. Installing: `pwd` + ln -svf ${lib}${libname}${librelease}${dll}.${libversion} ${lib}${libname}${dll} + \")") + endif() +endif() -- 2.40.0