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