]> git.lyx.org Git - lyx.git/blob - development/cmake/modules/FindGNUWIN32.cmake
find gettext tools
[lyx.git] / development / cmake / modules / FindGNUWIN32.cmake
1 #
2 #  from kdelibs
3 #
4
5 if(WIN32)
6
7         # check if GNUWIN32_DIR is already set 
8         # (e.g. by command line argument or the calling script)
9         if(NOT GNUWIN32_DIR)
10                 # check for enviroment variable
11                 file(TO_CMAKE_PATH "$ENV{GNUWIN32_DIR}" GNUWIN32_DIR)
12                 if(NOT GNUWIN32_DIR)
13                         # search in the default program install folder
14                         file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles)
15                         find_file(GNUWIN32_DIR gnuwin32 win32libs 
16                                         PATHS
17                                         "${_progFiles}"
18                                         "C:/" "D:/" "E:/" "F:/" "G:/"
19                         )
20                 endif()
21         endif()
22
23         if(GNUWIN32_DIR)
24                  set(GNUWIN32_INCLUDE_DIR ${GNUWIN32_DIR}/include)
25                  set(GNUWIN32_LIBRARY_DIR ${GNUWIN32_DIR}/lib)
26                  set(GNUWIN32_BINARY_DIR  ${GNUWIN32_DIR}/bin)
27                  set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${GNUWIN32_INCLUDE_DIR})
28                  set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${GNUWIN32_LIBRARY_DIR})
29                  set(GNUWIN32_FOUND TRUE)
30         else()
31                  set(GNUWIN32_FOUND)
32         endif()
33
34         if(GNUWIN32_FOUND)
35                 if (NOT GNUWIN32_FIND_QUIETLY)
36                         message(STATUS "Found GNUWIN32: ${GNUWIN32_DIR}")
37                 endif()
38         else()
39                 if (GNUWIN32_FIND_REQUIRED)
40                         set(GNUWIN32_DIR CACHE PATH FORCE)
41                         message(STATUS "ERROR: Could NOT find GNUWIN32, please set GNUWIN32_DIR")
42                         message(STATUS "ERROR: or let cmake download all required files by using -DLYX_DEPENDENCIES_DOWNLOAD=1")
43                         message(FATAL_ERROR)
44                 endif()
45         endif()
46
47 endif()
48