Merge branch 'release-4.0'
[kiteware-cmake.git] / Modules / FindCygwin.cmake
blob5bbc802a0d5c1058251b49698f5993b1308d778f
1 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
4 #[=======================================================================[.rst:
5 FindCygwin
6 ----------
8 Find Cygwin, a POSIX-compatible environment that runs natively
9 on Microsoft Windows
10 #]=======================================================================]
12 if (WIN32)
13   if(CYGWIN_INSTALL_PATH)
14     set(CYGWIN_BAT "${CYGWIN_INSTALL_PATH}/cygwin.bat")
15   endif()
17   find_program(CYGWIN_BAT
18     NAMES cygwin.bat
19     PATHS
20       "C:/Cygwin"
21       "C:/Cygwin64"
22       "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygwin\\setup;rootdir]"
23       "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/;native]"
24   )
25   get_filename_component(CYGWIN_INSTALL_PATH "${CYGWIN_BAT}" DIRECTORY)
26   mark_as_advanced(CYGWIN_BAT)
28 endif ()