Fix finding patch executable when cross-compiling on windows. (#627)

`WIN32` checks whether current build context is windows. This is not correct in case of cross-compiling, because we are interested in finding host's tools, not SDK's tools.
This commit is contained in:
Rokas Kupstys
2024-12-29 19:15:04 +02:00
committed by GitHub
parent 2a9e203320
commit cd28d445ae

View File

@@ -490,7 +490,7 @@ function(cpm_add_patches)
# Find the patch program.
find_program(PATCH_EXECUTABLE patch)
if(WIN32 AND NOT PATCH_EXECUTABLE)
if(CMAKE_HOST_WIN32 AND NOT PATCH_EXECUTABLE)
# The Windows git executable is distributed with patch.exe. Find the path to the executable, if
# it exists, then search `../usr/bin` and `../../usr/bin` for patch.exe.
find_package(Git QUIET)