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 FIND_PATH(PNG_INCLUDE_DIR png.h
17 /usr/local/include/libpng # OpenBSD
20 SET(PNG_NAMES_RELEASE ${PNG_NAMES_RELEASE} png libpng png12 libpng12)
21 FIND_LIBRARY(PNG_LIBRARY_RELEASE NAMES ${PNG_NAMES_RELEASE} )
23 SET(PNG_NAMES_DEBUG ${PNG_NAMES_DEBUG} pngd libpngd png12d libpng12d)
24 FIND_LIBRARY(PNG_LIBRARY_DEBUG NAMES ${PNG_NAMES_DEBUG} )
26 SET(PNG_LIBRARIES_FOUND )
29 SET(PNG_LIBRARIES_FOUND TRUE)
30 MARK_AS_ADVANCED(PNG_LIBRARY_DEBUG)
31 ENDIF(PNG_LIBRARY_DEBUG)
33 IF(PNG_LIBRARY_RELEASE)
34 SET(PNG_LIBRARIES_FOUND TRUE)
35 MARK_AS_ADVANCED(PNG_LIBRARY_RELEASE)
36 ENDIF(PNG_LIBRARY_RELEASE)
39 IF(PNG_LIBRARIES_FOUND AND PNG_INCLUDE_DIR)
40 # png.h includes zlib.h. Sigh.
41 # SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
42 # SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
46 # No need to define PNG_USE_DLL here, because it's default for
48 ELSE(BUILD_SHARED_LIBS)
49 SET (PNG_DEFINITIONS -DPNG_STATIC)
50 ENDIF(BUILD_SHARED_LIBS)
53 ENDIF(PNG_LIBRARIES_FOUND AND PNG_INCLUDE_DIR)
57 # handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
58 # all listed variables are TRUE
59 INCLUDE(FindPackageHandleStandardArgs)
60 FIND_PACKAGE_HANDLE_STANDARD_ARGS(PNG DEFAULT_MSG
61 PNG_LIBRARIES_FOUND PNG_INCLUDE_DIR)
63 MARK_AS_ADVANCED(PNG_INCLUDE_DIR PNG_LIBRARIES_FOUND)