| 1 |
# set all include directories for in and out of source builds |
| 2 |
include_directories( |
| 3 |
${CMAKE_CURRENT_SOURCE_DIR} |
| 4 |
${CMAKE_CURRENT_BINARY_DIR} |
| 5 |
${ZLIB_INCLUDE_DIRS} |
| 6 |
) |
| 7 |
|
| 8 |
file(GLOB SRCS "*.c" "*.cpp") |
| 9 |
file(GLOB PUBLIC_HEADERS "*.h") |
| 10 |
|
| 11 |
# Must be added to enable export macro |
| 12 |
ADD_DEFINITIONS(-DQUAZIP_BUILD) |
| 13 |
|
| 14 |
qt_wrap_cpp(MOC_SRCS ${PUBLIC_HEADERS}) |
| 15 |
set(SRCS ${SRCS} ${MOC_SRCS}) |
| 16 |
|
| 17 |
add_library(${QUAZIP_LIB_TARGET_NAME} SHARED ${SRCS}) |
| 18 |
add_library(quazip_static STATIC ${SRCS}) |
| 19 |
|
| 20 |
# Windows uses .lib extension for both static and shared library |
| 21 |
# *nix systems use different extensions for SHARED and STATIC library and by convention both libraries have the same name |
| 22 |
if (NOT WIN32) |
| 23 |
set_target_properties(quazip_static PROPERTIES OUTPUT_NAME quazip${QUAZIP_LIB_VERSION_SUFFIX}) |
| 24 |
endif () |
| 25 |
|
| 26 |
set_target_properties(${QUAZIP_LIB_TARGET_NAME} quazip_static PROPERTIES VERSION 1.0.0 SOVERSION 1 DEBUG_POSTFIX d) |
| 27 |
# Link against ZLIB_LIBRARIES if needed (on Windows this variable is empty) |
| 28 |
target_link_libraries(${QUAZIP_LIB_TARGET_NAME} quazip_static ${QT_QTMAIN_LIBRARY} ${QTCORE_LIBRARIES} ${ZLIB_LIBRARIES}) |
| 29 |
|
| 30 |
install(FILES ${PUBLIC_HEADERS} DESTINATION include/quazip${QUAZIP_LIB_VERSION_SUFFIX}) |
| 31 |
install(TARGETS ${QUAZIP_LIB_TARGET_NAME} quazip_static LIBRARY DESTINATION ${LIB_DESTINATION} ARCHIVE DESTINATION ${LIB_DESTINATION} RUNTIME DESTINATION ${LIB_DESTINATION}) |