5 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
8 # Already in cache, be silent
9 set(ZLIB_FIND_QUIETLY TRUE)
12 set(zlibsearch "/usr/include" "/usr/local/include")
14 list(APPEND zlibsearch "${GNUWIN32_DIR}/include")
17 find_path(ZLIB_INCLUDE_DIR zlib.h PATHS ${zlibsearch})
19 find_file(ZLIB_HEADER zlib.h
20 PATHS ${ZLIB_INCLUDE_DIR} NO_DEFAULT_PATH)
22 set(POTENTIAL_Z_LIBS z zlib zdll)
24 find_library(ZLIB_LIBRARY NAMES ${POTENTIAL_Z_LIBS}
26 ${ICONV_RELATIVE_TO_LIBINTL}
30 set(zlibsearch "C:\\Programme\\Microsoft Visual Studio 8\\VC\\lib")
32 list(APPEND zlibsearch ${SYSTEM_LIB_DIRS})
35 list(APPEND zlibsearch "${GNUWIN32_DIR}/lib")
37 find_library(ZLIB_LIBRARY NAMES ${POTENTIAL_Z_LIBS}
40 if(ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
45 if(NOT ZLIB_FIND_QUIETLY)
46 message(STATUS "Found Z: ${ZLIB_LIBRARY}")
49 if(ZLIB_FIND_REQUIRED)
50 message(STATUS "Looked for Z libraries named ${POTENTIAL_Z_LIBS}.")
51 message(STATUS "Found no acceptable Z library. This is fatal.")
52 message(FATAL_ERROR "Could NOT find z library, set GNUWIN32_DIR to dir containing /include and /bin folders: -DGNUWIN32_DIR=...")
56 mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)