aboutsummaryrefslogtreecommitdiff
path: root/cmake/scripts/windows
diff options
context:
space:
mode:
authorthexai <58434170+thexai@users.noreply.github.com>2022-05-08 15:34:44 +0200
committerthexai <58434170+thexai@users.noreply.github.com>2022-05-14 12:18:38 +0200
commitc18c1fcd330da4eaa070304e62f8d8964335a32b (patch)
treeefdcc7c8701cd11c908be103caba6c6dd02c3fce /cmake/scripts/windows
parentc4357207d65bf1af8e852769495aed8922a41b70 (diff)
[Windows] fix cmake find patch executable (prioritize use Git patch.exe)
Diffstat (limited to 'cmake/scripts/windows')
-rw-r--r--cmake/scripts/windows/tools/patch.cmake10
1 files changed, 9 insertions, 1 deletions
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()