Skip to content

Commit 0bc73f4

Browse files
authored
Additional search path for patch.exe (#581)
* Additional search path for patch.exe * Style
1 parent 8b67fe2 commit 0bc73f4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cmake/CPM.cmake

+7-4
Original file line numberDiff line numberDiff line change
@@ -477,13 +477,16 @@ function(cpm_add_patches)
477477
find_program(PATCH_EXECUTABLE patch)
478478
if(WIN32 AND NOT PATCH_EXECUTABLE)
479479
# The Windows git executable is distributed with patch.exe. Find the path to the executable, if
480-
# it exists, then search `../../usr/bin` for patch.exe.
480+
# it exists, then search `../usr/bin` and `../../usr/bin` for patch.exe.
481481
find_package(Git QUIET)
482482
if(GIT_EXECUTABLE)
483483
get_filename_component(extra_search_path ${GIT_EXECUTABLE} DIRECTORY)
484-
get_filename_component(extra_search_path ${extra_search_path} DIRECTORY)
485-
get_filename_component(extra_search_path ${extra_search_path} DIRECTORY)
486-
find_program(PATCH_EXECUTABLE patch HINTS "${extra_search_path}/usr/bin")
484+
get_filename_component(extra_search_path_1up ${extra_search_path} DIRECTORY)
485+
get_filename_component(extra_search_path_2up ${extra_search_path_1up} DIRECTORY)
486+
find_program(
487+
PATCH_EXECUTABLE patch HINTS "${extra_search_path_1up}/usr/bin"
488+
"${extra_search_path_2up}/usr/bin"
489+
)
487490
endif()
488491
endif()
489492
if(NOT PATCH_EXECUTABLE)

0 commit comments

Comments
 (0)