From: Guido Draheim Date: Thu, 13 Sep 2018 23:49:05 +0000 (+0200) Subject: breaking down VERSION to APIVERSION+RELVERSION, and make symlinks for the old release... X-Git-Tag: v0.13.72~121 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd17613b2463b37a830b867dcb9dd68d118e5565;p=zziplib breaking down VERSION to APIVERSION+RELVERSION, and make symlinks for the old releases as it was for automake's libtool --- diff --git a/CMakeLists.txt b/CMakeLists.txt index e9250f8..d3397fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,14 @@ cmake_minimum_required (VERSION 3.1) project(zziplib C) +set(VERSION "0.13.69") + +string(REGEX REPLACE "([^.]+)[.]([^.]+)[.]([^.]+)" "\\1" APIVERSION ${VERSION}) +string(REGEX REPLACE "([^.]+)[.]([^.]+)[.]([^.]+)" "\\2" RELVERSION ${VERSION}) +string(REGEX REPLACE "([^.]+)[.]([^.]+)[.]([^.]+)" "0.\\3" FIXVERSION ${VERSION}) +MESSAGE(STATUS "VERSION ${VERSION} -> APIVERSION ${APIVERSION}") +MESSAGE(STATUS "VERSION ${VERSION} -> RELVERSION ${RELVERSION}") +MESSAGE(STATUS "VERSION ${VERSION} -> FIXVERSION ${FIXVERSION}") +# the "0." on FIXVERSION is just for compatibility with automake's libtool. # generate _config.h include ( CheckIncludeFiles ) @@ -96,16 +105,23 @@ add_library(zzip ${ZZIPLIB_SRCS} ) target_link_libraries(zzip ZLIB::ZLIB ) target_include_directories (zzip PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) -if(NOT MSVC) # FIXME: syntax error - add_library(zzipmmapped zzip/mmapped.c zzip/memdisk.c zzip/fetch.c ) - target_link_libraries(zzipmmapped ZLIB::ZLIB ) - target_include_directories (zzipmmapped PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) -endif() - add_library(zzipfseeko zzip/fseeko.c zzip/fetch.c ) target_link_libraries(zzipfseeko ZLIB::ZLIB ) target_include_directories (zzipfseeko PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) +add_library(zzipmmapped zzip/mmapped.c zzip/memdisk.c zzip/fetch.c ) +target_link_libraries(zzipmmapped ZLIB::ZLIB ) +target_include_directories (zzipmmapped PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + +set_target_properties(zzip PROPERTIES OUTPUT_NAME "zzip-${APIVERSION}") +SET_TARGET_PROPERTIES(zzip PROPERTIES VERSION ${RELVERSION}.${FIXVERSION} SOVERSION ${RELVERSION}) + +set_target_properties(zzipfseeko PROPERTIES OUTPUT_NAME "zzipfseeko-${APIVERSION}") +SET_TARGET_PROPERTIES(zzipfseeko PROPERTIES VERSION ${RELVERSION}.${FIXVERSION} SOVERSION ${RELVERSION}) + +set_target_properties(zzipmmapped PROPERTIES OUTPUT_NAME "zzipmmapped-${APIVERSION}") +SET_TARGET_PROPERTIES(zzipmmapped PROPERTIES VERSION ${RELVERSION}.${FIXVERSION} SOVERSION ${RELVERSION}) + # install ######################################################## install(FILES ${ZZIPLIB_HDRS} DESTINATION include/zzip ) install(TARGETS zzip @@ -119,3 +135,18 @@ install(TARGETS zzipmmapped LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() + +if(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG) + get_target_property(libname zzip OUTPUT_NAME) + get_target_property(libversion zzip VERSION) + set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}) + set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX}) + install(CODE "execute_process( + COMMAND bash -c \"set -e + cd $DESTDIR/${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} + echo -n .. Installing: `pwd` + ln -sv ${lib}${libname}${dll}.${libversion} ${lib}${libname}${dll}.11 + echo -n .. Installing: `pwd` + ln -sv ${lib}${libname}${dll}.${libversion} ${lib}${libname}${dll}.12 + \")") +endif()