mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
move minizip detection to module
This commit is contained in:
parent
0541b544c4
commit
dcba7a6316
@ -1,8 +1,7 @@
|
||||
project(vcmi)
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
# TODO:
|
||||
# 1) Detection of system version of minizip and use it instead of local
|
||||
# 2) Detection of Qt5 and compilation of launcher, unless explicitly disabled
|
||||
# 1) Detection of Qt5 and compilation of launcher, unless explicitly disabled
|
||||
|
||||
# where to look for cmake modules
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules)
|
||||
@ -117,6 +116,10 @@ set(FFmpeg_FIND_COMPONENTS AVFORMAT SWSCALE)
|
||||
find_package(Boost 1.48.0 COMPONENTS filesystem locale program_options system thread REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(FFmpeg REQUIRED)
|
||||
find_package(Minizip)
|
||||
if (MINIZIP_FOUND)
|
||||
add_definitions(-DUSE_SYSTEM_MINIZIP)
|
||||
endif()
|
||||
|
||||
if (ENABLE_SDL2)
|
||||
find_package(SDL2 REQUIRED)
|
||||
@ -211,18 +214,6 @@ SET(PCH_PROPERTIES
|
||||
COTIRE_CXX_PREFIX_HEADER_INIT "StdInc.h"
|
||||
)
|
||||
|
||||
find_path(MINIZIP_INCLUDE_PATH NAMES minizip/unzip.h)
|
||||
find_library(MINIZIP_LIB NAMES minizip PATH_SUFFIXES dynamic)
|
||||
mark_as_advanced(MINIZIP_INCLUDE_PATH MINIZIP_LIB)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(MINIZIP MINIZIP_INCLUDE_PATH MINIZIP_LIB)
|
||||
if (MINIZIP_FOUND)
|
||||
set(MINIZIP_INCLUDE_DIR ${MINIZIP_INCLUDE_PATH})
|
||||
set(MINIZIP_LIBRARIES ${MINIZIP_LIB})
|
||||
add_definitions(-DUSE_SYSTEM_MINIZIP)
|
||||
endif()
|
||||
|
||||
if (ENABLE_ERM)
|
||||
add_subdirectory(scripting/erm)
|
||||
endif()
|
||||
|
72
cmake_modules/FindMinizip.cmake
Normal file
72
cmake_modules/FindMinizip.cmake
Normal file
@ -0,0 +1,72 @@
|
||||
#.rst:
|
||||
# FindMINIZIP
|
||||
# --------
|
||||
#
|
||||
# Locate Minizip library
|
||||
#
|
||||
# This module defines
|
||||
#
|
||||
# ::
|
||||
#
|
||||
# MINIZIP_LIBRARY, the name of the library to link against
|
||||
# MINIZIP_FOUND, if false, do not try to link to Minizip
|
||||
# MINIZIP_INCLUDE_DIR, where to find unzip.h
|
||||
# MINIZIP_VERSION_STRING, human-readable string containing the version of Minizip
|
||||
#
|
||||
#=============================================================================
|
||||
# Copyright 2003-2009 Kitware, Inc.
|
||||
# Copyright 2012 Benjamin Eikel
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file kitware license.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(VC_LIB_PATH_SUFFIX lib/x64)
|
||||
else()
|
||||
set(VC_LIB_PATH_SUFFIX lib/x86)
|
||||
endif()
|
||||
|
||||
if (NOT WIN32)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_MINIZIP minizip)
|
||||
set(MINIZIP_VERSION_STRING ${_MINIZIP_VERSION})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
find_path(MINIZIP_INCLUDE_DIR
|
||||
minizip/unzip.h
|
||||
HINTS
|
||||
${_MINIZIP_INCLUDEDIR}
|
||||
ENV MINIZIPDIR
|
||||
PATH_SUFFIXES
|
||||
MINIZIP
|
||||
include
|
||||
)
|
||||
|
||||
find_library(MINIZIP_LIBRARY
|
||||
NAMES
|
||||
minizip
|
||||
HINTS
|
||||
${_MINIZIP_LIBDIR}
|
||||
ENV MINIZIPDIR
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
${VC_LIB_PATH_SUFFIX}
|
||||
)
|
||||
|
||||
set(MINIZIP_LIBRARIES ${MINIZIP_LIBRARY})
|
||||
set(MINIZIP_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MINIZIP
|
||||
REQUIRED_VARS MINIZIP_LIBRARY MINIZIP_INCLUDE_DIR
|
||||
VERSION_VAR MINIZIP_VERSION_STRING)
|
Loading…
Reference in New Issue
Block a user