Skip to content

Commit

Permalink
#117 implant ZZIP_LIBLATEST for zzipwrap.lib
Browse files Browse the repository at this point in the history
  • Loading branch information
gdraheim committed May 22, 2021
1 parent 0e8d35f commit c835ad6
Showing 1 changed file with 18 additions and 26 deletions.
44 changes: 18 additions & 26 deletions zzipwrap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand Down Expand Up @@ -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 $<TARGET_FILE_NAME:libzzipwrap> ${lib}${libname}${dll}
)
install(FILES
${outdir}/${lib}${libname}${dll}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()

# messages #######################################################
Expand Down

0 comments on commit c835ad6

Please sign in to comment.