FindPNG.cmake 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # - Find the native PNG includes and library
  2. #
  3. # This module defines
  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.
  11. # PNG depends on Zlib
  12. INCLUDE(FindZLIB)
  13. IF(ZLIB_FOUND)
  14. FIND_PATH(PNG_PNG_INCLUDE_DIR png.h
  15. /usr/local/include
  16. /usr/include
  17. )
  18. FIND_LIBRARY(PNG_LIBRARY png
  19. /usr/lib
  20. /usr/local/lib
  21. )
  22. IF (PNG_LIBRARY)
  23. IF (PNG_PNG_INCLUDE_DIR)
  24. # png.h includes zlib.h. Sigh.
  25. SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
  26. SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
  27. SET(PNG_FOUND "YES")
  28. IF (CYGWIN)
  29. IF(BUILD_SHARED_LIBS)
  30. # No need to define PNG_USE_DLL here, because it's default for Cygwin.
  31. ELSE(BUILD_SHARED_LIBS)
  32. SET (PNG_DEFINITIONS -DPNG_STATIC)
  33. ENDIF(BUILD_SHARED_LIBS)
  34. ENDIF (CYGWIN)
  35. ENDIF (PNG_PNG_INCLUDE_DIR)
  36. ENDIF (PNG_LIBRARY)
  37. ENDIF(ZLIB_FOUND)