forked from Mirrors/openclonk
cmake: Also look for static libraries
parent
94b726c9ad
commit
8709b841bf
|
@ -839,7 +839,7 @@ if(MSVC)
|
|||
endif()
|
||||
|
||||
if(NOT USE_CONSOLE)
|
||||
SET(JPEG_NAMES ${JPEG_NAMES} libjpeg)
|
||||
SET(JPEG_NAMES ${JPEG_NAMES} libjpeg jpeg-static)
|
||||
include(FindJPEG)
|
||||
endif()
|
||||
include(FindPNG)
|
||||
|
|
|
@ -70,7 +70,7 @@ if(ZLIB_FOUND)
|
|||
endif ()
|
||||
if (PNG_VERSION_STRING)
|
||||
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*" "png\\1\\2" PNG_VERSIONED_LIBRARY "${PNG_VERSION_STRING}")
|
||||
set(PNG_VERSIONED_LIBRARY ${PNG_VERSIONED_LIBRARY} lib${PNG_VERSIONED_LIBRARY} ${PNG_VERSIONED_LIBRARY}d lib${PNG_VERSIONED_LIBRARY}d)
|
||||
set(PNG_VERSIONED_LIBRARY ${PNG_VERSIONED_LIBRARY} lib${PNG_VERSIONED_LIBRARY} lib${PNG_VERSIONED_LIBRARY}_static ${PNG_VERSIONED_LIBRARY}d lib${PNG_VERSIONED_LIBRARY}d lib${PNG_VERSIONED_LIBRARY}d_static)
|
||||
endif ()
|
||||
|
||||
set(PNG_NAMES ${PNG_NAMES} png libpng ${PNG_VERSIONED_LIBRARY} png15 libpng15 png15d libpng15d png14 libpng14 png14d libpng14d png12 libpng12 png12d libpng12d)
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
# - Find zlib
|
||||
# Find the native ZLIB includes and library.
|
||||
# Once done this will define
|
||||
#
|
||||
# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
|
||||
# ZLIB_LIBRARIES - List of libraries when using zlib.
|
||||
# ZLIB_FOUND - True if zlib found.
|
||||
#
|
||||
# ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
|
||||
# ZLIB_VERSION_MAJOR - The major version of zlib
|
||||
# ZLIB_VERSION_MINOR - The minor version of zlib
|
||||
# ZLIB_VERSION_PATCH - The patch version of zlib
|
||||
# ZLIB_VERSION_TWEAK - The tweak version of zlib
|
||||
#
|
||||
# The following variable are provided for backward compatibility
|
||||
#
|
||||
# ZLIB_MAJOR_VERSION - The major version of zlib
|
||||
# ZLIB_MINOR_VERSION - The minor version of zlib
|
||||
# ZLIB_PATCH_VERSION - The patch version of zlib
|
||||
#
|
||||
# An includer may set ZLIB_ROOT to a zlib installation root to tell
|
||||
# this module where to look.
|
||||
|
||||
#=============================================================================
|
||||
# CMake - Cross Platform Makefile Generator
|
||||
# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
|
||||
# nor the names of their contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
|
||||
set(_ZLIB_SEARCHES)
|
||||
|
||||
# Search ZLIB_ROOT first if it is set.
|
||||
if(ZLIB_ROOT)
|
||||
set(_ZLIB_SEARCH_ROOT PATHS ${ZLIB_ROOT} NO_DEFAULT_PATH)
|
||||
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_ROOT)
|
||||
endif()
|
||||
|
||||
# Normal search.
|
||||
set(_ZLIB_SEARCH_NORMAL
|
||||
PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]"
|
||||
"$ENV{PROGRAMFILES}/zlib"
|
||||
)
|
||||
list(APPEND _ZLIB_SEARCHES _ZLIB_SEARCH_NORMAL)
|
||||
|
||||
set(ZLIB_NAMES z zlib zlibstatic zdll zlib1 zlibd zlibd1)
|
||||
|
||||
# Try each search configuration.
|
||||
foreach(search ${_ZLIB_SEARCHES})
|
||||
find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
|
||||
find_library(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ${${search}} PATH_SUFFIXES lib)
|
||||
endforeach()
|
||||
|
||||
mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
|
||||
|
||||
if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
|
||||
file(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$")
|
||||
|
||||
string(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}")
|
||||
string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}")
|
||||
string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}")
|
||||
set(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}")
|
||||
|
||||
# only append a TWEAK version if it exists:
|
||||
set(ZLIB_VERSION_TWEAK "")
|
||||
if( "${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$")
|
||||
set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}")
|
||||
set(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}")
|
||||
endif()
|
||||
|
||||
set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}")
|
||||
set(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}")
|
||||
set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}")
|
||||
endif()
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_LIBRARY ZLIB_INCLUDE_DIR
|
||||
VERSION_VAR ZLIB_VERSION_STRING)
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
|
||||
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue