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.
|
2009-07-21 20:45:37 +04:00
|
|
|
# PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files.
|
2005-12-14 21:51:08 +03:00
|
|
|
# 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
|
2009-07-21 20:45:37 +04:00
|
|
|
include(FindZLIB)
|
2002-09-02 22:08:30 +04:00
|
|
|
|
2009-07-21 20:45:37 +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
|
|
|
)
|
|
|
|
|
2009-07-21 20:45:37 +04:00
|
|
|
set(PNG_NAMES ${PNG_NAMES} png libpng png12 libpng12)
|
|
|
|
find_library(PNG_LIBRARY NAMES ${PNG_NAMES} )
|
2002-09-02 22:08:30 +04:00
|
|
|
|
2009-07-21 20:45:37 +04: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})
|
|
|
|
|
2009-07-21 20:45:37 +04:00
|
|
|
if (CYGWIN)
|
|
|
|
if(BUILD_SHARED_LIBS)
|
2002-09-02 22:08:30 +04:00
|
|
|
# No need to define PNG_USE_DLL here, because it's default for Cygwin.
|
2009-07-21 20:45:37 +04:00
|
|
|
else(BUILD_SHARED_LIBS)
|
2002-09-02 22:08:30 +04:00
|
|
|
SET (PNG_DEFINITIONS -DPNG_STATIC)
|
2009-07-21 20:45:37 +04:00
|
|
|
endif(BUILD_SHARED_LIBS)
|
|
|
|
endif (CYGWIN)
|
2002-09-02 22:08:30 +04:00
|
|
|
|
2009-07-21 20:45:37 +04:00
|
|
|
endif (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
|
2002-09-02 22:08:30 +04:00
|
|
|
|
2009-07-21 20:45:37 +04:00
|
|
|
endif(ZLIB_FOUND)
|
2006-03-20 20:29:56 +03:00
|
|
|
|
2009-07-21 20:45:37 +04:00
|
|
|
# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
|
2007-07-18 21:56:45 +04:00
|
|
|
# all listed variables are TRUE
|
2009-07-21 20:45:37 +04:00
|
|
|
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
|
|
|
|
2009-07-21 20:45:37 +04:00
|
|
|
mark_as_advanced(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )
|