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.
|
|
|
|
# PNG_DEFINITIONS - You should ADD_DEFINITONS(${PNG_DEFINITIONS}) before compiling code that includes png library files.
|
|
|
|
# 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
|
2004-08-27 06:52:53 +04:00
|
|
|
INCLUDE(FindZLIB)
|
2002-09-02 22:08:30 +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
|
|
|
)
|
|
|
|
|
2006-02-09 23:33:58 +03:00
|
|
|
SET(PNG_NAMES ${PNG_NAMES} png libpng)
|
2007-07-18 21:56:45 +04:00
|
|
|
FIND_LIBRARY(PNG_LIBRARY NAMES ${PNG_NAMES} )
|
2002-09-02 22:08:30 +04:00
|
|
|
|
2006-03-20 20:29:56 +03: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})
|
|
|
|
|
|
|
|
IF (CYGWIN)
|
|
|
|
IF(BUILD_SHARED_LIBS)
|
|
|
|
# No need to define PNG_USE_DLL here, because it's default for Cygwin.
|
|
|
|
ELSE(BUILD_SHARED_LIBS)
|
|
|
|
SET (PNG_DEFINITIONS -DPNG_STATIC)
|
|
|
|
ENDIF(BUILD_SHARED_LIBS)
|
|
|
|
ENDIF (CYGWIN)
|
|
|
|
|
2006-03-20 20:29:56 +03:00
|
|
|
ENDIF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
|
2002-09-02 22:08:30 +04:00
|
|
|
|
2004-08-27 06:52:53 +04:00
|
|
|
ENDIF(ZLIB_FOUND)
|
2006-03-20 20:29:56 +03:00
|
|
|
|
2007-07-18 21:56:45 +04:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
|
|
|
|
# all listed variables are TRUE
|
|
|
|
INCLUDE(FindPackageHandleStandardArgs)
|
2007-07-23 17:49:52 +04:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PNG DEFAULT_MSG PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
|
2006-08-30 21:47:54 +04:00
|
|
|
|
2006-03-20 20:29:56 +03:00
|
|
|
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
|