source: Vago/quazip-0.7.2/CMakeLists.txt@ 1058

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