Replaced local FindZLIB.cmake usage with CMake's own FindZLIB.cmake, and ZLIB_LIBRARY to ZLIB_LIBRARIES

This commit is contained in:
Robert Osfield 2017-05-23 16:33:16 +01:00
parent e606e0b4de
commit c18be2fc41
10 changed files with 9 additions and 67 deletions

View File

@ -1,58 +0,0 @@
# 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)

View File

@ -162,7 +162,7 @@ ENDIF()
IF( ZLIB_FOUND ) IF( ZLIB_FOUND )
ADD_DEFINITIONS( -DUSE_ZLIB ) ADD_DEFINITIONS( -DUSE_ZLIB )
INCLUDE_DIRECTORIES( ${ZLIB_INCLUDE_DIR} ) INCLUDE_DIRECTORIES( ${ZLIB_INCLUDE_DIR} )
SET(COMPRESSION_LIBRARIES ZLIB_LIBRARY) SET(COMPRESSION_LIBRARIES ZLIB_LIBRARIES)
ENDIF() ENDIF()
################################################################################ ################################################################################

View File

@ -24,7 +24,7 @@ SET(TARGET_H
IF(ZLIB_FOUND) IF(ZLIB_FOUND)
SET(TARGET_LIBRARIES_VARS SET(TARGET_LIBRARIES_VARS
CURL_LIBRARY CURL_LIBRARY
ZLIB_LIBRARY) ZLIB_LIBRARIES)
ELSE() ELSE()
SET(TARGET_LIBRARIES_VARS SET(TARGET_LIBRARIES_VARS
CURL_LIBRARY) CURL_LIBRARY)

View File

@ -5,7 +5,7 @@ IF (DCMTK_FOUND)
SET(TARGET_SRC ReaderWriterDICOM.cpp ) SET(TARGET_SRC ReaderWriterDICOM.cpp )
LINK_LIBRARIES(${DCMTK_LIBRARIES} ${ZLIB_LIBRARY}) LINK_LIBRARIES(${DCMTK_LIBRARIES} ${ZLIB_LIBRARIES})
ADD_DEFINITIONS(-DUSE_DCMTK) ADD_DEFINITIONS(-DUSE_DCMTK)

View File

@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES( ${OPENEXR_INCLUDE_DIR}/OpenEXR )
SET(TARGET_SRC ReaderWriterEXR.cpp ) SET(TARGET_SRC ReaderWriterEXR.cpp )
SET(TARGET_LIBRARIES_VARS ${OPENEXR_LIBRARIES_VARS} ZLIB_LIBRARY) SET(TARGET_LIBRARIES_VARS ${OPENEXR_LIBRARIES_VARS} ZLIB_LIBRARIES)
IF(CMAKE_COMPILER_IS_GNUCXX) IF(CMAKE_COMPILER_IS_GNUCXX)
# Remove -Wshadow flag as it barfs on ffmoeg headers # Remove -Wshadow flag as it barfs on ffmoeg headers

View File

@ -4,7 +4,7 @@ SET(TARGET_SRC
ReaderWriterGZ.cpp ReaderWriterGZ.cpp
) )
SET(TARGET_LIBRARIES_VARS ZLIB_LIBRARY ) SET(TARGET_LIBRARIES_VARS ZLIB_LIBRARIES )
#### end var setup ### #### end var setup ###

View File

@ -269,7 +269,7 @@ SET(TARGET_H
SET(TARGET_ADDED_LIBRARIES osgSim osgFX osgText osgTerrain osgVolume) SET(TARGET_ADDED_LIBRARIES osgSim osgFX osgText osgTerrain osgVolume)
IF(ZLIB_FOUND) IF(ZLIB_FOUND)
SET(TARGET_LIBRARIES_VARS ZLIB_LIBRARY) SET(TARGET_LIBRARIES_VARS ZLIB_LIBRARIES)
ENDIF() ENDIF()
#### end var setup ### #### end var setup ###

View File

@ -5,7 +5,7 @@ IF(OSG_CPP_EXCEPTIONS_AVAILABLE)
ENDIF() ENDIF()
SET(TARGET_SRC ReaderWriterPNG.cpp ) SET(TARGET_SRC ReaderWriterPNG.cpp )
SET(TARGET_LIBRARIES_VARS PNG_LIBRARY ZLIB_LIBRARY ) SET(TARGET_LIBRARIES_VARS PNG_LIBRARY ZLIB_LIBRARIES )
#### end var setup ### #### end var setup ###

View File

@ -4,7 +4,7 @@ INCLUDE_DIRECTORIES(${LIBVNCSERVER_INCLUDE_DIR})
SET(TARGET_EXTERNAL_LIBRARIES SET(TARGET_EXTERNAL_LIBRARIES
${LIBVNCCLIENT_LIBRARY} ${LIBVNCCLIENT_LIBRARY}
${ZLIB_LIBRARY} ${ZLIB_LIBRARIES}
${JPEG_LIBRARY} ) ${JPEG_LIBRARY} )
SET(TARGET_ADDED_LIBRARIES osgWidget ) SET(TARGET_ADDED_LIBRARIES osgWidget )

View File

@ -25,7 +25,7 @@ IF (WIN32)
OPENVRML_LIBRARY OPENVRML_LIBRARY
JPEG_LIBRARY JPEG_LIBRARY
PNG_LIBRARY PNG_LIBRARY
ZLIB_LIBRARY) ZLIB_LIBRARIES)
SET(TARGET_EXTERNAL_LIBRARIES SET(TARGET_EXTERNAL_LIBRARIES
Ws2_32.lib) Ws2_32.lib)
ELSE() ELSE()