File: FindZLIB.cmake

package info (click to toggle)
harp 1.29-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 57,028 kB
  • sloc: xml: 475,954; ansic: 175,442; sh: 4,898; yacc: 2,186; javascript: 1,510; python: 1,148; makefile: 656; lex: 591
file content (40 lines) | stat: -rw-r--r-- 1,320 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Find the Zlib library
#
# This module defines
# ZLIB_INCLUDE_DIR, where to find zlib.h
# ZLIB_LIBRARIES, the libraries to link against to use Zlib.
# ZLIB_FOUND, If false, do not try to use Zlib
#
# The user may specify ZLIB_INCLUDE_DIR and ZLIB_LIBRARY_DIR variables
# to locate include and library files
#
include(CheckLibraryExists)
include(CheckIncludeFile)

set(ZLIB_INCLUDE_DIR CACHE STRING "Location of ZLIB include files")
set(ZLIB_LIBRARY_DIR CACHE STRING "Location of ZLIB library files")

if(ZLIB_INCLUDE_DIR)
  set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIR})
endif(ZLIB_INCLUDE_DIR)

check_include_file(zlib.h HAVE_ZLIB_H)

find_library(ZLIB_LIBRARY NAMES zlibdll zlib z PATHS ${ZLIB_LIBRARY_DIR})
if(ZLIB_LIBRARY)
  check_library_exists(${ZLIB_LIBRARY} deflate "" HAVE_ZLIB_LIBRARY)
endif(ZLIB_LIBRARY)
if(HAVE_ZLIB_LIBRARY)
  set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
endif(HAVE_ZLIB_LIBRARY)

if(WIN32 AND HAVE_ZLIB_LIBRARY)
get_filename_component(ZLIB_LIBRARY_NAME ${ZLIB_LIBRARY} NAME_WE)
find_file(ZLIB_DLL NAMES ${ZLIB_LIBRARY_NAME}.dll PATHS ${ZLIB_LIBRARY_DIR} ${ZLIB_LIBRARY_DIR}/../bin)
if(ZLIB_DLL)
set(ZLIB_DLLS ${ZLIB_DLL})
endif(ZLIB_DLL)
endif(WIN32 AND HAVE_ZLIB_LIBRARY)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ZLIB DEFAULT_MSG HAVE_ZLIB_LIBRARY HAVE_ZLIB_H)