2005-12-14 18:51:08 +00:00
|
|
|
# - Find the native PNG includes and library
|
2002-09-02 18:08:30 +00:00
|
|
|
#
|
|
|
|
# This module defines
|
2005-12-14 18:51:08 +00:00
|
|
|
# PNG_INCLUDE_DIR, where to find png.h, etc.
|
|
|
|
# PNG_LIBRARIES, the libraries to link against to use PNG.
|
2009-07-21 16:45:37 +00:00
|
|
|
# PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files.
|
2005-12-14 18:51:08 +00:00
|
|
|
# PNG_FOUND, If false, do not try to use PNG.
|
2002-09-02 18:08:30 +00:00
|
|
|
# also defined, but not for general use are
|
2005-12-14 18:51:08 +00:00
|
|
|
# PNG_LIBRARY, where to find the PNG library.
|
2002-09-02 18:08:30 +00:00
|
|
|
# None of the above will be defined unles zlib can be found.
|
|
|
|
# PNG depends on Zlib
|
2009-09-14 19:53:07 +00:00
|
|
|
|
2009-09-28 15:45:50 +00:00
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2002-2009 Kitware, Inc.
|
|
|
|
#
|
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
|
|
|
#
|
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
2010-08-07 00:48:47 +00:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 15:45:50 +00:00
|
|
|
# License text for the above reference.)
|
2009-09-14 19:53:07 +00:00
|
|
|
|
|
|
|
if(PNG_FIND_QUIETLY)
|
|
|
|
set(_FIND_ZLIB_ARG QUIET)
|
|
|
|
endif(PNG_FIND_QUIETLY)
|
|
|
|
find_package(ZLIB ${_FIND_ZLIB_ARG})
|
2002-09-02 18:08:30 +00:00
|
|
|
|
2009-07-21 16:45:37 +00:00
|
|
|
if(ZLIB_FOUND)
|
|
|
|
find_path(PNG_PNG_INCLUDE_DIR png.h
|
2006-08-30 17:47:54 +00:00
|
|
|
/usr/local/include/libpng # OpenBSD
|
2002-09-02 18:08:30 +00:00
|
|
|
)
|
|
|
|
|
2010-04-19 16:31:08 +00:00
|
|
|
set(PNG_NAMES ${PNG_NAMES} png libpng png14 libpng14 png14d libpng14d png12 libpng12 png12d libpng12d)
|
2009-07-21 16:45:37 +00:00
|
|
|
find_library(PNG_LIBRARY NAMES ${PNG_NAMES} )
|
2002-09-02 18:08:30 +00:00
|
|
|
|
2009-07-21 16:45:37 +00:00
|
|
|
if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
|
2002-09-02 18:08:30 +00:00
|
|
|
# png.h includes zlib.h. Sigh.
|
|
|
|
SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
|
|
|
|
SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
|
|
|
|
|
2009-07-21 16:45:37 +00:00
|
|
|
if (CYGWIN)
|
|
|
|
if(BUILD_SHARED_LIBS)
|
2002-09-02 18:08:30 +00:00
|
|
|
# No need to define PNG_USE_DLL here, because it's default for Cygwin.
|
2009-07-21 16:45:37 +00:00
|
|
|
else(BUILD_SHARED_LIBS)
|
2002-09-02 18:08:30 +00:00
|
|
|
SET (PNG_DEFINITIONS -DPNG_STATIC)
|
2009-07-21 16:45:37 +00:00
|
|
|
endif(BUILD_SHARED_LIBS)
|
|
|
|
endif (CYGWIN)
|
2002-09-02 18:08:30 +00:00
|
|
|
|
2009-07-21 16:45:37 +00:00
|
|
|
endif (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
|
2002-09-02 18:08:30 +00:00
|
|
|
|
2009-07-21 16:45:37 +00:00
|
|
|
endif(ZLIB_FOUND)
|
2006-03-20 17:29:56 +00:00
|
|
|
|
2009-07-21 16:45:37 +00:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
|
2007-07-18 17:56:45 +00:00
|
|
|
# all listed variables are TRUE
|
2010-12-20 20:56:51 +00:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2009-09-14 19:53:07 +00:00
|
|
|
find_package_handle_standard_args(PNG DEFAULT_MSG PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
|
2006-08-30 17:47:54 +00:00
|
|
|
|
2009-07-21 16:45:37 +00:00
|
|
|
mark_as_advanced(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
|