diff --git a/CMake/resources.cmake b/CMake/resources.cmake
index 37c0c08..b1f52d1 100644
--- a/CMake/resources.cmake
+++ b/CMake/resources.cmake
@@ -26,10 +26,10 @@ find_file(HAVE_DLFCN_H dlfcn.h)
 find_file(HAVE_FREETYPE_H freetype.h PATH_SUFFIXES freetype2 freetype2/freetype)
 find_file(HAVE_GL_GL_H GL/gl.h)
 find_file(HAVE_GL_GLU_H GL/glu.h)
-find_file(HAVE_LIBPNG_PNG_H libpng/png.h)
+#find_file(HAVE_LIBPNG_PNG_H libpng/png.h)
 find_file(HAVE_LOCALE_H locale.h)
 find_file(HAVE_OPENGL_GLU_H OpenGL/glu.h)
-find_file(HAVE_PNG_H png.h)
+#find_file(HAVE_PNG_H png.h)
 find_file(HAVE_PTHREAD_H pthread.h)
 find_file(HAVE_STDIO_H stdio.h)
 find_file(HAVE_STRINGS_H strings.h)
@@ -38,6 +38,17 @@ find_file(HAVE_SYS_STDTYPES_H sys/stdtypes.h)
 find_file(HAVE_X11_XREGION_H X11/Xregion.h)
 find_path(HAVE_XDBE_H Xdbe.h PATH_SUFFIXES X11/extensions extensions)
 
+find_package(PNG REQUIRED)
+if(PNG_FOUND)
+	set(LIB_png ${PNG_LIBRARIES})
+	set(HAVE_PNG_H ${PNG_FOUND})
+	
+endif()
+find_package(ZLIB REQUIRED)
+if(ZLIB_FOUND)
+	set(LIB_zlib ${ZLIB_LIBRARIES})
+endif()
+
 if (MSVC)
   message(STATUS "Note: The following three headers should all be found!")
   message(STATUS "HAVE_GL_GL_H = '${HAVE_GL_GL_H}'")
@@ -92,12 +103,12 @@ find_library(LIB_freetype freetype)
 find_library(LIB_GL GL)
 find_library(LIB_MesaGL MesaGL)
 find_library(LIB_jpeg jpeg)
-find_library(LIB_png png)
-find_library(LIB_zlib z)
+#find_library(LIB_png png)
+#find_library(LIB_zlib z)
 
 mark_as_advanced(LIB_CAIRO LIB_dl LIB_fontconfig LIB_freetype)
 mark_as_advanced(LIB_GL LIB_MesaGL)
-mark_as_advanced(LIB_jpeg LIB_png LIB_zlib)
+mark_as_advanced(LIB_jpeg)
 
 #######################################################################
 # functions
