]> git.lyx.org Git - lyx.git/blob - development/cmake/modules/FindZLIB.cmake
find gettext tools
[lyx.git] / development / cmake / modules / FindZLIB.cmake
1 #
2 #  based on cmake file
3 #
4
5 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
6
7 if (ZLIB_INCLUDE_DIR)
8   # Already in cache, be silent
9   set(ZLIB_FIND_QUIETLY TRUE)
10 endif()
11
12 find_path(ZLIB_INCLUDE_DIR zlib.h
13  /usr/include
14  /usr/local/include
15  "${GNUWIN32_DIR}"/include)
16
17 set(POTENTIAL_Z_LIBS z zlib zdll)
18
19 find_library(ZLIB_LIBRARY NAMES ${POTENTIAL_Z_LIBS}
20         PATHS 
21         "C:\\Programme\\Microsoft Visual Studio 8\\VC\\lib"
22         /usr/lib /usr/local/lib
23         "${GNUWIN32_DIR}"/lib)
24
25 if(ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
26    set(ZLIB_FOUND TRUE)
27 endif()
28
29 if(ZLIB_FOUND)
30    if(NOT ZLIB_FIND_QUIETLY)
31       message(STATUS "Found Z: ${ZLIB_LIBRARY}")
32    endif()
33 else()
34    if(ZLIB_FIND_REQUIRED)
35       message(STATUS "Looked for Z libraries named ${POTENTIAL_Z_LIBS}.")
36       message(STATUS "Found no acceptable Z library. This is fatal.")
37       message(FATAL_ERROR "Could NOT find z library, set GNUWIN32_DIR to dir containing /include and /bin folders: -DGNUWIN32_DIR=...")
38    endif()
39 endif()
40
41 mark_as_advanced(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)