summaryrefslogtreecommitdiff
path: root/Modules/FindPNG.cmake
diff options
context:
space:
mode:
authorIan Scott <ian.m.scott@stud.man.ac.uk>2002-09-02 14:08:30 -0400
committerIan Scott <ian.m.scott@stud.man.ac.uk>2002-09-02 14:08:30 -0400
commit8600beb1ed81dccbe427c78d501c81a6c46eee69 (patch)
tree419461c12e65c982a0326a6a97221e2f89f572d6 /Modules/FindPNG.cmake
parent3663167b9e1d2e57998534cfc2b455f676dad838 (diff)
downloadcmake-8600beb1ed81dccbe427c78d501c81a6c46eee69.tar.gz
Adding Zlib and PNG find modules in the new format
Diffstat (limited to 'Modules/FindPNG.cmake')
-rw-r--r--Modules/FindPNG.cmake47
1 files changed, 47 insertions, 0 deletions
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
new file mode 100644
index 0000000000..528a17fe13
--- /dev/null
+++ b/Modules/FindPNG.cmake
@@ -0,0 +1,47 @@
+#
+# Find the native PNG includes and library
+#
+
+# This module defines
+# PNG_INCLUDE_DIR, where to find png.h, etc.
+# PNG_LIBRARIES, the libraries to link against to use PNG.
+# PNG_FOUND, If false, do try to use PNG.
+
+# also defined, but not for general use are
+# PNG_LIBRARY, where to find the PNG library.
+
+# None of the above will be defined unles zlib can be found.
+
+# PNG depends on Zlib
+INCLUDE( ${MODULE_PATH}/NewCMake/FindZLIB.cmake )
+
+IF(ZLIB_FOUND)
+ FIND_PATH(PNG_PNG_INCLUDE_DIR png.h
+ /usr/local/include
+ /usr/include
+ )
+
+ FIND_LIBRARY(PNG_LIBRARY png
+ /usr/lib
+ /usr/local/lib
+ )
+
+ IF (PNG_LIBRARY)
+ IF (PNG_PNG_INCLUDE_DIR)
+ # png.h includes zlib.h. Sigh.
+ SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
+ SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
+ SET(PNG_FOUND "YES")
+
+ IF (CYGWIN)
+ IF(BUILD_SHARED_LIBS)
+ # No need to define PNG_USE_DLL here, because it's default for Cygwin.
+ ELSE(BUILD_SHARED_LIBS)
+ SET (PNG_DEFINITIONS -DPNG_STATIC)
+ ENDIF(BUILD_SHARED_LIBS)
+ ENDIF (CYGWIN)
+
+ ENDIF (PNG_PNG_INCLUDE_DIR)
+ ENDIF (PNG_LIBRARY)
+
+ENDIF(ZLIB_FOUND) \ No newline at end of file