This commit is contained in:
alqualos 2017-02-04 12:04:14 +00:00
parent 8e44a088f0
commit 4a3f6b4074

View file

@ -1,6 +1,11 @@
project (QuaZip)
project(QuaZip)
cmake_minimum_required(VERSION 2.6)
# CMP0042: Explicitly acknowledge MACOSX_RPATH
# (introduced in CMake 2.8.12, enabled by default in CMake 3.0,
# and producing a warning when unset since 3.7.1)
cmake_policy(SET CMP0042 NEW)
option(BUILD_WITH_QT4 "Build QuaZip with Qt4 no matter if Qt5 was found" OFF)
if( NOT BUILD_WITH_QT4 )
@ -8,11 +13,12 @@ if( NOT BUILD_WITH_QT4 )
find_package(Qt5Core QUIET)
endif()
if (Qt5Core_FOUND)
if(Qt5Core_FOUND)
set(CMAKE_CXX_STANDARD 11)
set(QTCORE_LIBRARIES ${Qt5Core_LIBRARIES})
set(QUAZIP_LIB_VERSION_SUFFIX 5)
# if there is no QT_ROOT, try to deduce it from Qt QtCore include
if ("${QT_ROOT}" STREQUAL "")
if("${QT_ROOT}" STREQUAL "")
set(QT_ROOT ${QT_QTCORE_INCLUDE_DIR}/../..)
endif()
include_directories(${Qt5Core_INCLUDE_DIRS})
@ -34,18 +40,18 @@ else()
endif()
# Use system zlib on unix and Qt ZLIB on Windows
IF(UNIX OR MINGW)
find_package(ZLIB REQUIRED)
ELSE(UNIX)
SET(ZLIB_INCLUDE_DIRS "${QT_ROOT}/src/3rdparty/zlib" CACHE STRING "Path to ZLIB headers of Qt")
SET(ZLIB_LIBRARIES "")
IF(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h")
MESSAGE("Please specify a valid zlib include dir")
ENDIF(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h")
ENDIF(UNIX)
if(UNIX OR MINGW)
find_package(ZLIB REQUIRED)
else(UNIX OR MINGW)
set(ZLIB_INCLUDE_DIRS "${QT_ROOT}/src/3rdparty/zlib" CACHE STRING "Path to ZLIB headers of Qt")
set(ZLIB_LIBRARIES "")
if(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h")
message("Please specify a valid zlib include dir")
endif(NOT EXISTS "${ZLIB_INCLUDE_DIRS}/zlib.h")
endif(UNIX OR MINGW)
# All build libraries are moved to this directory
SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
set(LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Library directory name" FORCE)