2 # Find the native ZLIB includes and library
6 # ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
7 # ZLIB_LIBRARIES - List of libraries when using zlib.
8 # ZLIB_FOUND - True if zlib found.
10 #=============================================================================
11 # Copyright 2001-2009 Kitware, Inc.
13 # Distributed under the OSI-approved BSD License (the "License");
14 # see accompanying file Copyright.txt for details.
16 # This software is distributed WITHOUT ANY WARRANTY; without even the
17 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 # See the License for more information.
19 #=============================================================================
20 # (To distributed this file outside of CMake, substitute the full
21 # License text for the above reference.)
24 # Already in cache, be silent
25 SET(ZLIB_FIND_QUIETLY TRUE)
26 ENDIF (ZLIB_INCLUDE_DIR)
28 FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)
30 SET(ZLIB_NAMES z zlib zdll)
31 FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} )
32 MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR )
35 SET(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}")
36 SET(ZLIB_LIBRARIES "${ZLIB_LIBRARY}")
38 INCLUDE(CheckFunctionExists)
39 SET(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES})
40 CHECK_FUNCTION_EXISTS("gzclearerr" HAVE_GZCLEARERR)
42 SET(CMAKE_REQUIRED_LIBRARIES "")
44 # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
45 # all listed variables are TRUE
46 INCLUDE(FindPackageHandleStandardArgs)
47 FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS)