From 62930253a3d3eb983f846a3cf20f36e34c71cb9e Mon Sep 17 00:00:00 2001 From: Tibor Szabo Date: Fri, 11 Aug 2017 11:30:35 +0200 Subject: FindCygwin: Fix regression when CYGWIN_INSTALL_PATH is already set The change in commit v3.9.0-rc1~54^2 (FindCygwin: Use find_program instead of find_path, 2017-05-18) broke cases when `CYGWIN_INSTALL_PATH` is already set, e.g. on the command-line or by an earlier call to `find_package(Cygwin)`. Since `find_program` now finds the actual `cygwin.bat` file, use a separate cache entry to save the location and then compute `CYGWIN_INSTALL_PATH`. If `CYGWIN_INSTALL_PATH` is already set, use that to avoid `find_program` having to search. --- Modules/FindCygwin.cmake | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Modules/FindCygwin.cmake') diff --git a/Modules/FindCygwin.cmake b/Modules/FindCygwin.cmake index b2ed70333c..c6913da17b 100644 --- a/Modules/FindCygwin.cmake +++ b/Modules/FindCygwin.cmake @@ -8,14 +8,17 @@ # this module looks for Cygwin if (WIN32) - find_program(CYGWIN_INSTALL_PATH + if(CYGWIN_INSTALL_PATH) + set(CYGWIN_BAT "${CYGWIN_INSTALL_PATH}/cygwin.bat") + endif() + + find_program(CYGWIN_BAT cygwin.bat "C:/Cygwin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygwin\\setup;rootdir]" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\/;native]" ) - get_filename_component(CYGWIN_INSTALL_PATH "${CYGWIN_INSTALL_PATH}" DIRECTORY) - mark_as_advanced( - CYGWIN_INSTALL_PATH - ) + get_filename_component(CYGWIN_INSTALL_PATH "${CYGWIN_BAT}" DIRECTORY) + mark_as_advanced(CYGWIN_BAT) + endif () -- cgit v1.2.1