|
| 1 | +project (QuaZip) |
| 2 | +cmake_minimum_required(VERSION 2.6) |
| 3 | + |
| 4 | +option(BUILD_WITH_QT4 "Build QuaZip with Qt4 no matter if Qt5 was found" OFF) |
| 5 | + |
| 6 | +if( NOT BUILD_WITH_QT4 ) |
| 7 | + # try Qt5 first, and prefer that if found |
| 8 | + find_package(Qt5Core QUIET) |
| 9 | +endif() |
| 10 | + |
| 11 | +if (Qt5Core_FOUND) |
| 12 | + set(QTCORE_LIBRARIES ${Qt5Core_LIBRARIES}) |
| 13 | + # if there is no QT_ROOT, try to deduce it from Qt QtCore include |
| 14 | + if ("${QT_ROOT}" STREQUAL "") |
| 15 | + set(QT_ROOT ${QT_QTCORE_INCLUDE_DIR}/../..) |
| 16 | + endif() |
| 17 | + include_directories(${Qt5Core_INCLUDE_DIRS}) |
| 18 | + |
| 19 | + macro(qt_wrap_cpp) |
| 20 | + qt5_wrap_cpp(${ARGN}) |
| 21 | + endmacro() |
| 22 | +else() |
| 23 | + set(qt_min_version "4.5.0") |
| 24 | + find_package(Qt4 REQUIRED) |
| 25 | + set(QT_USE_QTGUI false) |
| 26 | + include(${QT_USE_FILE}) |
| 27 | + include_directories(${QT_INCLUDES}) |
| 28 | + set(QTCORE_LIBRARIES ${QT_QTCORE_LIBRARY}) |
| 29 | + |
| 30 | + macro(qt_wrap_cpp) |
| 31 | + qt4_wrap_cpp(${ARGN}) |
| 32 | + endmacro() |
| 33 | +endif() |
| 34 | + |
| 35 | +# Use system zlib on unix and Qt ZLIB on Windows |
| 36 | +IF(UNIX) |
| 37 | + find_package(ZLIB REQUIRED) |
| 38 | +ELSE(UNIX) |
| 39 | + SET(ZLIB_INCLUDE_DIRS "${QT_ROOT}/src/3rdparty/zlib" CACHE STRING "Path to ZLIB headers of Qt") |
| 40 | + SET(ZLIB_LIBRARIES "") |
| 41 | + IF(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h") |
| 42 | + MESSAGE("Please specify a valid zlib include dir") |
| 43 | + ENDIF(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h") |
| 44 | +ENDIF(UNIX) |
| 45 | + |
| 46 | +# All build libraries are moved to this directory |
| 47 | +SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}) |
| 48 | + |
| 49 | +set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)") |
| 50 | +set(LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Library directory name" FORCE) |
| 51 | + |
| 52 | +add_subdirectory(quazip) |
| 53 | + |
| 54 | +install(FILES FindQuaZip.cmake DESTINATION ${CMAKE_ROOT}/Modules) |
0 commit comments