]> granicus.if.org Git - zziplib/commitdiff
make an explicit ZZIPLIBTOOL compatibility flag to highlight the feature
authorGuido Draheim <guidod@gmx.de>
Sun, 16 Sep 2018 13:02:02 +0000 (15:02 +0200)
committerGuido Draheim <guidod@gmx.de>
Sun, 16 Sep 2018 13:02:02 +0000 (15:02 +0200)
zzip/CMakeLists.txt
zzipwrap/CMakeLists.txt

index aea8b6f35df0b00660b0d8e7ac51c1efe539be64..2cfa46e915b28bf1c4cd68318d967de5ec231688 100644 (file)
@@ -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)
index 2e6835f3d3bf1649db832e2a191d0e432d0e87e9..c4abbf922bedd921da134fb76c064a8735ef253e 100644 (file)
@@ -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()