Skip to content

Commit 4cc1cca

Browse files
committed
Revert "try to fix 3rd party patch"
This reverts commit a712d52.
1 parent a712d52 commit 4cc1cca

File tree

1 file changed

+12
-30
lines changed

1 file changed

+12
-30
lines changed

cmake/utils.cmake

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,28 @@
11
function(apply_patch_once patch_name target_dir patch_file)
2-
# Store marker in build dir so it is cleaned with the build directory,
3-
# avoiding stale markers when submodule sources are reset by git.
4-
set(mark_file "${CMAKE_CURRENT_BINARY_DIR}/.${patch_name}_patched")
2+
set(mark_file "${target_dir}/.${patch_name}_patched")
53

64
if(EXISTS "${mark_file}")
5+
#message(STATUS "Patch '${patch_name}' already applied to ${target_dir}, skipping.")
76
return()
87
endif()
98

109
if(NOT EXISTS "${patch_file}")
1110
message(FATAL_ERROR "Patch file '${patch_file}' not found!")
1211
endif()
1312

13+
#message(STATUS "Applying patch '${patch_name}' to ${target_dir} ...")
1414
execute_process(
15-
COMMAND git apply --check --ignore-space-change --ignore-whitespace "${patch_file}"
16-
WORKING_DIRECTORY "${target_dir}"
17-
RESULT_VARIABLE check_result
18-
OUTPUT_QUIET ERROR_QUIET
15+
COMMAND git apply --ignore-space-change --ignore-whitespace "${patch_file}"
16+
WORKING_DIRECTORY "${target_dir}"
17+
RESULT_VARIABLE patch_result
18+
OUTPUT_VARIABLE patch_stdout
19+
ERROR_VARIABLE patch_stderr
1920
)
2021

21-
if (check_result EQUAL 0)
22-
execute_process(
23-
COMMAND git apply --ignore-space-change --ignore-whitespace "${patch_file}"
24-
WORKING_DIRECTORY "${target_dir}"
25-
RESULT_VARIABLE patch_result
26-
OUTPUT_VARIABLE patch_stdout
27-
ERROR_VARIABLE patch_stderr
28-
)
29-
if (NOT patch_result EQUAL 0)
30-
message(FATAL_ERROR "Failed to apply patch '${patch_name}' to ${target_dir}:\n${patch_stderr}")
31-
endif ()
22+
if(NOT patch_result EQUAL 0)
23+
message(FATAL_ERROR "Failed to apply patch '${patch_name}' to ${target_dir}:\n${patch_stderr}")
3224
else()
33-
# Patch cannot be applied cleanly - verify it is already applied
34-
execute_process(
35-
COMMAND git apply --reverse --check --ignore-space-change --ignore-whitespace "${patch_file}"
36-
WORKING_DIRECTORY "${target_dir}"
37-
RESULT_VARIABLE reverse_result
38-
OUTPUT_QUIET ERROR_QUIET
39-
)
40-
if (NOT reverse_result EQUAL 0)
41-
message(FATAL_ERROR "Patch '${patch_name}' cannot be applied to ${target_dir} and does not appear to be already applied.")
42-
endif ()
25+
#message(STATUS "Patch '${patch_name}' applied successfully:\n${patch_stdout}")
26+
file(WRITE "${mark_file}" "patched")
4327
endif()
44-
45-
file(WRITE "${mark_file}" "patched")
4628
endfunction()

0 commit comments

Comments
 (0)