]> git.lyx.org Git - lyx.git/blob - development/cmake/modules/FindGNUWIN32.cmake
cmake: don't forget command line options
[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_tmp gnuwin32 win32libs 
16                         PATHS
17                         "${_progFiles}"
18                         "C:/" "D:/" "E:/" "F:/" "G:/"
19                 )
20                 set(GNUWIN32_DIR ${GNUWIN32_DIR_tmp})
21         endif(NOT GNUWIN32_DIR)
22 else(NOT GNUWIN32_DIR)
23         SET(GNUWIN32_DIR ${GNUWIN32_DIR} CACHE TYPE STRING)
24 endif(NOT GNUWIN32_DIR)
25
26 if (GNUWIN32_DIR)
27    set(GNUWIN32_INCLUDE_DIR ${GNUWIN32_DIR}/include)
28    set(GNUWIN32_LIBRARY_DIR ${GNUWIN32_DIR}/lib)
29    set(GNUWIN32_BINARY_DIR  ${GNUWIN32_DIR}/bin)
30    set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${GNUWIN32_INCLUDE_DIR})
31    set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${GNUWIN32_LIBRARY_DIR})
32    set(GNUWIN32_FOUND TRUE)
33 else (GNUWIN32_DIR)
34    set(GNUWIN32_FOUND)
35 endif (GNUWIN32_DIR)
36
37 if (GNUWIN32_FOUND)
38   if (NOT GNUWIN32_FIND_QUIETLY)
39     message(STATUS "Found GNUWIN32: ${GNUWIN32_DIR}")
40   endif (NOT GNUWIN32_FIND_QUIETLY)
41 else (GNUWIN32_FOUND)
42   if (GNUWIN32_FIND_REQUIRED)
43     message(SEND_ERROR "Could NOT find GNUWIN32")
44   endif (GNUWIN32_FIND_REQUIRED)
45 endif (GNUWIN32_FOUND)
46
47 endif (WIN32)
48