From c18c1fcd330da4eaa070304e62f8d8964335a32b Mon Sep 17 00:00:00 2001 From: thexai <58434170+thexai@users.noreply.github.com> Date: Sun, 8 May 2022 15:34:44 +0200 Subject: [Windows] fix cmake find patch executable (prioritize use Git patch.exe) --- cmake/scripts/windows/tools/patch.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'cmake/scripts/windows') diff --git a/cmake/scripts/windows/tools/patch.cmake b/cmake/scripts/windows/tools/patch.cmake index b955b4cdcf..451fc6664c 100644 --- a/cmake/scripts/windows/tools/patch.cmake +++ b/cmake/scripts/windows/tools/patch.cmake @@ -1,4 +1,12 @@ -find_program(PATCH_FOUND NAMES patch patch.exe) +# prioritize Git patch.exe +find_package(Git) +if(Git_FOUND) + get_filename_component(GIT_DIR ${GIT_EXECUTABLE} DIRECTORY) + get_filename_component(GIT_DIR ${GIT_DIR} DIRECTORY) +endif() + +find_program(PATCH_FOUND NAMES patch.exe HINTS ${GIT_DIR} PATH_SUFFIXES usr/bin) + if(PATCH_FOUND) message(STATUS "patch utility found at ${PATCH_FOUND}") else() -- cgit v1.2.3