OpenSceneGraph/CMakeModules/FindZLIB.cmake
Robert Osfield fa6f5219bf From Mattias Helsing, "I finally got to fix the cmake Modules that have duplicates in later
version of cmake. See attached submission. I have tested the ones that
I compile myself (GDAL, Freetype, ZLIB) on ubuntu 12.04 with
cmake-2.8.7."
2014-04-29 12:19:21 +00:00

59 lines
1.2 KiB
CMake

# Locate zlib
# This module defines
# ZLIB_LIBRARY
# ZLIB_FOUND, if false, do not try to link to zlib
# ZLIB_INCLUDE_DIR, where to find the headers
#
# $ZLIB_DIR is an environment variable that would
# correspond to the ./configure --prefix=$ZLIB_DIR
# used in building zlib.
#
# Created by Ulrich Hertlein.
# prefer FindZLIB from cmake distribution
if(EXISTS ${CMAKE_ROOT}/Modules/FindZLIB.cmake)
include(${CMAKE_ROOT}/Modules/FindZLIB.cmake)
if(ZLIB_FOUND)
return()
endif()
endif()
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
$ENV{ZLIB_DIR}/include
$ENV{ZLIB_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
/usr/freeware/include
)
FIND_LIBRARY(ZLIB_LIBRARY
NAMES z libz zlib
PATHS
$ENV{ZLIB_DIR}/lib
$ENV{ZLIB_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
SET(ZLIB_FOUND "NO")
IF(ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)
SET(ZLIB_FOUND "YES")
ENDIF(ZLIB_LIBRARY AND ZLIB_INCLUDE_DIR)