diff options
Diffstat (limited to 'project/cmake/scripts/common/handle-depends.cmake')
| -rw-r--r-- | project/cmake/scripts/common/handle-depends.cmake | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/project/cmake/scripts/common/handle-depends.cmake b/project/cmake/scripts/common/handle-depends.cmake index b3bf3cd..4d78928 100644 --- a/project/cmake/scripts/common/handle-depends.cmake +++ b/project/cmake/scripts/common/handle-depends.cmake | |||
| @@ -86,8 +86,26 @@ function(add_addon_depends addon searchpath) | |||
| 86 | file(GLOB patches ${dir}/*.patch) | 86 | file(GLOB patches ${dir}/*.patch) |
| 87 | list(SORT patches) | 87 | list(SORT patches) |
| 88 | foreach(patch ${patches}) | 88 | foreach(patch ${patches}) |
| 89 | if(NOT PATCH_PROGRAM OR "${PATCH_PROGRAM}" STREQUAL "") | ||
| 90 | if(NOT PATCH_EXECUTABLE) | ||
| 91 | # find the path to the patch executable | ||
| 92 | find_program(PATCH_EXECUTABLE NAMES patch) | ||
| 93 | |||
| 94 | if(NOT PATCH_EXECUTABLE) | ||
| 95 | message(FATAL_ERROR "Missing patch command (we looked in ${CMAKE_PREFIX_PATH})") | ||
| 96 | endif() | ||
| 97 | endif() | ||
| 98 | |||
| 99 | # on windows "patch.exe" can only handle CR-LF line-endings so we | ||
| 100 | # need to force it to also handle LF-only line endings | ||
| 101 | set(PATCH_PROGRAM ${PATCH_EXECUTABLE}) | ||
| 102 | if(WIN32) | ||
| 103 | set(PATCH_PROGRAM "\"${PATCH_PROGRAM}\" --binary") | ||
| 104 | endif() | ||
| 105 | endif() | ||
| 106 | |||
| 89 | file(APPEND ${PATCH_FILE} | 107 | file(APPEND ${PATCH_FILE} |
| 90 | "execute_process(COMMAND patch -p1 -i ${patch})\n") | 108 | "execute_process(COMMAND ${PATCH_PROGRAM} -p1 -i \"${patch}\")\n") |
| 91 | endforeach() | 109 | endforeach() |
| 92 | 110 | ||
| 93 | 111 | ||
