--- a/CMakeModules/FindZLIB.cmake
+++ b/CMakeModules/FindZLIB.cmake
@@ -26,42 +26,20 @@
   ${wxWidgets_ROOT_DIR}/src/zlib
 )
 
-SET(ZLIB_NAMES z zlib zdll wxzlib)
-FIND_LIBRARY(ZLIB_LIBRARY
-  NAMES ${ZLIB_NAMES}
+include(FindLibraryWithDebug)
+
+find_library_with_debug(ZLIB_LIBRARIES
+  WIN32_DEBUG_POSTFIX d
+  NAMES z zlib wxzlib
   PATHS /usr/lib /usr/local/lib ${wxWidgets_LIB_DIR}
 )
 
-SET(ZLIB_DEBUG_NAMES zd zlibd zdlld wxzlibd)
-FIND_LIBRARY(ZLIB_DEBUG_LIBRARY
-  NAMES ${ZLIB_DEBUG_NAMES}
-  PATHS /usr/lib /usr/local/lib ${wxWidgets_LIB_DIR}
-)
 
-IF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
-    SET(ZLIB_FOUND TRUE)
-    SET( ZLIB_LIBRARIES ${ZLIB_LIBRARY} )
-    IF (ZLIB_DEBUG_LIBRARY)
-        SET(ZLIB_DEBUG_LIBRARIES ${ZLIB_DEBUG_LIBRARY})
-    ENDIF(ZLIB_DEBUG_LIBRARY)
-ELSE (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
-   SET(ZLIB_FOUND FALSE)
-   SET( ZLIB_LIBRARIES )
-ENDIF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
-
-IF (ZLIB_FOUND)
-   IF (NOT ZLIB_FIND_QUIETLY)
-      MESSAGE(STATUS "Found ZLIB: ${ZLIB_LIBRARY}")
-   ENDIF (NOT ZLIB_FIND_QUIETLY)
-ELSE (ZLIB_FOUND)
-   IF (ZLIB_FIND_REQUIRED)
-      MESSAGE(STATUS "Looked for Z libraries named ${ZLIBS_NAMES}.")
-      MESSAGE(FATAL_ERROR "Could NOT find z library")
-   ENDIF (ZLIB_FIND_REQUIRED)
-ENDIF (ZLIB_FOUND)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ZLIB DEFAULT_MSG 
+                                  ZLIB_INCLUDE_DIR ZLIB_LIBRARIES)
 
 MARK_AS_ADVANCED(
-  ZLIB_LIBRARY
-  ZLIB_DEBUG_LIBRARY
+  ZLIB_LIBRARIES
   ZLIB_INCLUDE_DIR
   )