diff --git a/zzipwrap/CMakeLists.txt b/zzipwrap/CMakeLists.txt index 062b38e6..006a4065 100644 --- a/zzipwrap/CMakeLists.txt +++ b/zzipwrap/CMakeLists.txt @@ -21,6 +21,12 @@ option(ZZIP_LIBTOOL "Ensure binary compatibility with libtool" OFF) option(ZZIP_PKGCONFIG "Generate pkg-config files for linking" OFF) endif() +if(ZZIP_LIBTOOL OR ZZIP_PKGCONFIG) +option(ZZIP_LIBLATEST "Ensure libname.lib links to libname-REL.lib" ON) +else() +option(ZZIP_LIBLATEST "Ensure libname.lib links to libname-REL.lib" OFF) +endif() + check_include_files ( unistd.h ZZIP_HAVE_UNISTD_H ) # set ( ZZIP_HAVE_ZLIB_H 1 ) @@ -87,37 +93,23 @@ install(TARGETS libzzipwrap ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -if(ZZIP_LIBTOOL) - if(BUILD_SHARED_LIBS AND CMAKE_SHARED_LIBRARY_SONAME_C_FLAG) - execute_process(COMMAND bash -c "ln --help" - OUTPUT_VARIABLE ln_verbose_help - ERROR_QUIET - ) - string(FIND "${ln_verbose_help}" "verbose" ln_verbose_found) - if(${ln_verbose_found} STREQUAL "-1") - set(ln_svf "ln -sf") - else() - set(ln_svf "ln -svf") - endif() - message(STATUS "Can symlink libraries with: ${ln_svf}") - endif() -endif() - -if(ZZIP_LIBTOOL) - if(BUILD_SHARED_LIBS AND CMAKE_SHARED_LIBRARY_SONAME_C_FLAG) +if(ZZIP_LIBLATEST) + if(BUILD_SHARED_LIBS) set(lib ${CMAKE_SHARED_LIBRARY_PREFIX}) set(dll ${CMAKE_SHARED_LIBRARY_SUFFIX}) + else() + set(lib ${CMAKE_STATIC_LIBRARY_PREFIX}) + set(dll ${CMAKE_STATIC_LIBRARY_SUFFIX}) + endif() set(libdir ${CMAKE_INSTALL_FULL_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() + add_custom_target(libzzipwrap_latest ALL + COMMAND ${CMAKE_COMMAND} -E create_symlink $ ${lib}${libname}${dll} + ) + install(FILES + ${outdir}/${lib}${libname}${dll} + DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() # messages #######################################################