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 )