2016-09-18 20:50:08 -07:00
|
|
|
function(vcpkg_apply_patches)
|
|
|
|
cmake_parse_arguments(_ap "" "SOURCE_PATH" "PATCHES" ${ARGN})
|
|
|
|
|
|
|
|
find_program(GIT git)
|
|
|
|
set(PATCHNUM 0)
|
|
|
|
foreach(PATCH ${_ap_PATCHES})
|
|
|
|
message(STATUS "Applying patch ${PATCH}")
|
|
|
|
set(LOGNAME patch-${TARGET_TRIPLET}-${PATCHNUM})
|
|
|
|
execute_process(
|
2016-10-24 17:06:33 -07:00
|
|
|
COMMAND ${GIT} --work-tree=. --git-dir=. apply "${PATCH}" --ignore-whitespace --whitespace=nowarn --verbose
|
2016-09-18 20:50:08 -07:00
|
|
|
OUTPUT_FILE ${CURRENT_BUILDTREES_DIR}/${LOGNAME}-out.log
|
|
|
|
ERROR_FILE ${CURRENT_BUILDTREES_DIR}/${LOGNAME}-err.log
|
|
|
|
WORKING_DIRECTORY ${_ap_SOURCE_PATH}
|
|
|
|
RESULT_VARIABLE error_code
|
|
|
|
)
|
2016-10-18 16:17:47 -07:00
|
|
|
|
|
|
|
if(error_code)
|
2016-10-18 18:25:45 -07:00
|
|
|
message(STATUS
|
2016-10-24 21:13:30 -07:00
|
|
|
"Applying patch failed: ${GIT} --work-tree=. --git-dir=. apply \"${PATCH}\" --ignore-whitespace --whitespace=nowarn --verbose\n"
|
|
|
|
"-- Working Directory: ${_ap_SOURCE_PATH}\n"
|
|
|
|
"-- This is expected if this patch was previously applied.\n"
|
|
|
|
"-- See logs for more information: ${CURRENT_BUILDTREES_DIR}/${LOGNAME}-out.log ${CURRENT_BUILDTREES_DIR}/${LOGNAME}-err.log")
|
2016-10-18 16:17:47 -07:00
|
|
|
endif()
|
|
|
|
|
2016-09-18 20:50:08 -07:00
|
|
|
message(STATUS "Applying patch ${PATCH} done")
|
|
|
|
math(EXPR PATCHNUM "${PATCHNUM}+1")
|
|
|
|
endforeach()
|
|
|
|
endfunction()
|