1 # - Find the native PNG includes and library
4 # PNG_INCLUDE_DIR, where to find png.h, etc.
5 # PNG_LIBRARIES, the libraries to link against to use PNG.
6 # PNG_DEFINITIONS - You should ADD_DEFINITONS(${PNG_DEFINITIONS}) before compiling code that includes png library files.
7 # PNG_FOUND, If false, do not try to use PNG.
8 # also defined, but not for general use are
9 # PNG_LIBRARY, where to find the PNG library.
10 # None of the above will be defined unles zlib can be found.
15 FIND_PATH(PNG_PNG_INCLUDE_DIR png.h
16 /usr/local/include/libpng # OpenBSD
19 SET(PNG_NAMES ${PNG_NAMES} png libpng png12 libpng12)
20 FIND_LIBRARY(PNG_LIBRARY NAMES ${PNG_NAMES} )
22 IF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
23 # png.h includes zlib.h. Sigh.
24 SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
25 SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
29 # No need to define PNG_USE_DLL here, because it's default for Cygwin.
30 ELSE(BUILD_SHARED_LIBS)
31 SET (PNG_DEFINITIONS -DPNG_STATIC)
32 ENDIF(BUILD_SHARED_LIBS)
35 ENDIF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
39 # handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
40 # all listed variables are TRUE
41 INCLUDE(FindPackageHandleStandardArgs)
42 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PNG DEFAULT_MSG PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
44 MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )