2005-12-14 21:51:08 +03:00
|
|
|
# - Find the native PNG includes and library
|
2002-09-02 22:08:30 +04:00
|
|
|
#
|
|
|
|
# This module defines
|
2005-12-14 21:51:08 +03:00
|
|
|
# PNG_INCLUDE_DIR, where to find png.h, etc.
|
|
|
|
# PNG_LIBRARIES, the libraries to link against to use PNG.
|
2009-07-21 20:45:37 +04:00
|
|
|
# PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files.
|
2005-12-14 21:51:08 +03:00
|
|
|
# PNG_FOUND, If false, do not try to use PNG.
|
2002-09-02 22:08:30 +04:00
|
|
|
# also defined, but not for general use are
|
2005-12-14 21:51:08 +03:00
|
|
|
# PNG_LIBRARY, where to find the PNG library.
|
2002-09-02 22:08:30 +04:00
|
|
|
# None of the above will be defined unles zlib can be found.
|
|
|
|
# PNG depends on Zlib
|
2009-09-14 23:53:07 +04:00
|
|
|
|
2009-09-28 19:45:50 +04: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 04:48:47 +04:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 19:45:50 +04:00
|
|
|
# License text for the above reference.)
|
2009-09-14 23:53:07 +04:00
|
|
|
|
|
|
|
if(PNG_FIND_QUIETLY)
|
|
|
|
set(_FIND_ZLIB_ARG QUIET)
|
|
|
|
endif(PNG_FIND_QUIETLY)
|
|
|
|
find_package(ZLIB ${_FIND_ZLIB_ARG})
|
2002-09-02 22:08:30 +04:00
|
|
|
|
2009-07-21 20:45:37 +04:00
|
|
|
if(ZLIB_FOUND)
|
|
|
|
find_path(PNG_PNG_INCLUDE_DIR png.h
|
2006-08-30 21:47:54 +04:00
|
|
|
/usr/local/include/libpng # OpenBSD
|
2002-09-02 22:08:30 +04:00
|
|
|
)
|
|
|
|
|
2010-04-19 20:31:08 +04:00
|
|
|
set(PNG_NAMES ${PNG_NAMES} png libpng png14 libpng14 png14d libpng14d png12 libpng12 png12d libpng12d)
|
2009-07-21 20:45:37 +04:00
|
|
|
find_library(PNG_LIBRARY NAMES ${PNG_NAMES} )
|
2002-09-02 22:08:30 +04:00
|
|
|
|
2009-07-21 20:45:37 +04:00
|
|
|
if (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
|
2002-09-02 22:08:30 +04: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 20:45:37 +04:00
|
|
|
if (CYGWIN)
|
|
|
|
if(BUILD_SHARED_LIBS)
|
2002-09-02 22:08:30 +04:00
|
|
|
# No need to define PNG_USE_DLL here, because it's default for Cygwin.
|
2009-07-21 20:45:37 +04:00
|
|
|
else(BUILD_SHARED_LIBS)
|
2002-09-02 22:08:30 +04:00
|
|
|
SET (PNG_DEFINITIONS -DPNG_STATIC)
|
2009-07-21 20:45:37 +04:00
|
|
|
endif(BUILD_SHARED_LIBS)
|
|
|
|
endif (CYGWIN)
|
2002-09-02 22:08:30 +04:00
|
|
|
|
2009-07-21 20:45:37 +04:00
|
|
|
endif (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
|
2002-09-02 22:08:30 +04:00
|
|
|
|
2009-07-21 20:45:37 +04:00
|
|
|
endif(ZLIB_FOUND)
|
2006-03-20 20:29:56 +03:00
|
|
|
|
2009-07-21 20:45:37 +04:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
|
2007-07-18 21:56:45 +04:00
|
|
|
# all listed variables are TRUE
|
2010-09-29 00:30:31 +04:00
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake")
|
2009-09-14 23:53:07 +04:00
|
|
|
find_package_handle_standard_args(PNG DEFAULT_MSG PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
|
2006-08-30 21:47:54 +04:00
|
|
|
|
2009-07-21 20:45:37 +04:00
|
|
|
mark_as_advanced(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
|