aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/scripts/common/HandleDepends.cmake12
-rw-r--r--cmake/scripts/windows/tools/patch.cmake10
-rw-r--r--cmake/scripts/windowsstore/tools/patch.cmake10
3 files changed, 29 insertions, 3 deletions
diff --git a/cmake/scripts/common/HandleDepends.cmake b/cmake/scripts/common/HandleDepends.cmake
index c737c6aef7..f3a821de28 100644
--- a/cmake/scripts/common/HandleDepends.cmake
+++ b/cmake/scripts/common/HandleDepends.cmake
@@ -116,8 +116,18 @@ function(add_addon_depends addon searchpath)
if(NOT PATCH_PROGRAM OR "${PATCH_PROGRAM}" STREQUAL "")
if(NOT PATCH_EXECUTABLE)
# find the path to the patch executable
- find_program(PATCH_EXECUTABLE NAMES patch)
+ if(WIN32)
+ # On Windows 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_EXECUTABLE NAMES patch.exe HINTS ${GIT_DIR} PATH_SUFFIXES usr/bin)
+ else()
+ find_program(PATCH_EXECUTABLE NAMES patch)
+ endif()
if(NOT PATCH_EXECUTABLE)
message(FATAL_ERROR "Missing patch command (we looked in ${CMAKE_PREFIX_PATH})")
endif()
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()
diff --git a/cmake/scripts/windowsstore/tools/patch.cmake b/cmake/scripts/windowsstore/tools/patch.cmake
index b955b4cdcf..451fc6664c 100644
--- a/cmake/scripts/windowsstore/tools/patch.cmake
+++ b/cmake/scripts/windowsstore/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()