Enable static library build by CMake (patch #21)

This commit is contained in:
alqualos 2015-01-29 18:28:19 +00:00
parent dcbd974dd7
commit 5e831c69c7

View file

@ -15,9 +15,17 @@ qt_wrap_cpp(MOC_SRCS ${PUBLIC_HEADERS})
set(SRCS ${SRCS} ${MOC_SRCS})
add_library(${QUAZIP_LIB_TARGET_NAME} SHARED ${SRCS})
set_target_properties(${QUAZIP_LIB_TARGET_NAME} PROPERTIES VERSION 1.0.0 SOVERSION 1)
add_library(quazip_static STATIC ${SRCS})
# Windows uses .lib extension for both static and shared library
# *nix systems use different extensions for SHARED and STATIC library and by convention both libraries have the same name
if (NOT WIN32)
set_target_properties(quazip_static PROPERTIES OUTPUT_NAME quazip)
endif ()
set_target_properties(${QUAZIP_LIB_TARGET_NAME} quazip_static PROPERTIES VERSION 1.0.0 SOVERSION 1 DEBUG_POSTFIX d)
# Link against ZLIB_LIBRARIES if needed (on Windows this variable is empty)
target_link_libraries(${QUAZIP_LIB_TARGET_NAME} ${QT_QTMAIN_LIBRARY} ${QTCORE_LIBRARIES} ${ZLIB_LIBRARIES})
target_link_libraries(${QUAZIP_LIB_TARGET_NAME} quazip_static ${QT_QTMAIN_LIBRARY} ${QTCORE_LIBRARIES} ${ZLIB_LIBRARIES})
install(FILES ${PUBLIC_HEADERS} DESTINATION include/quazip)
install(TARGETS ${QUAZIP_LIB_TARGET_NAME} LIBRARY DESTINATION ${LIB_DESTINATION} ARCHIVE DESTINATION ${LIB_DESTINATION} RUNTIME DESTINATION ${LIB_DESTINATION})
install(TARGETS ${QUAZIP_LIB_TARGET_NAME} quazip_static LIBRARY DESTINATION ${LIB_DESTINATION} ARCHIVE DESTINATION ${LIB_DESTINATION} RUNTIME DESTINATION ${LIB_DESTINATION})