mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-21 17:17:50 +08:00
cc00cf05fb
* Add libplist * Add libusbmuxd * Fix typos * Add getopt * Add libimobiledevice * Fix typos * Add libideviceactivation * Add ideviceinstaller * Include utilities * Install usbmuxd * Add readline * Fix readline on 64-bit windows * Add libirecovery * libideviceactivation: include tools * Bump versions to fix build issues * Bump versions * Add idevicerestore * [getopt][getopt-win32] Rename to getopt-win32 and only install on Windows Desktop * [readline][readline-win32] Rename to readline-win32 and only install for Windows Desktop * [vcpkg_from_github][vcpkg_apply_patches] Make PATCHES relative to the current port directory * [vcpkg_install_msbuild][vcpkg_check_linkage] Introduce vcpkg_install_msbuild() and vcpkg_check_linkage(). * [libimobiledevice et al] Use vcpkg_from_github() and vcpkg_install_msbuild() * [readline] Fix static builds
58 lines
2.0 KiB
CMake
58 lines
2.0 KiB
CMake
## # vcpkg_apply_patches
|
|
##
|
|
## Apply a set of patches to a source tree.
|
|
##
|
|
## ## Usage
|
|
## ```cmake
|
|
## vcpkg_apply_patches(
|
|
## SOURCE_PATH <${SOURCE_PATH}>
|
|
## [QUIET]
|
|
## PATCHES <patch1.patch>...
|
|
## )
|
|
## ```
|
|
##
|
|
## ## Parameters
|
|
## ### SOURCE_PATH
|
|
## The source path in which apply the patches. By convention, this is usually set in the portfile as the variable `SOURCE_PATH`.
|
|
##
|
|
## ### PATCHES
|
|
## A list of patches that are applied to the source tree.
|
|
##
|
|
## Generally, these take the form of `${CMAKE_CURRENT_LIST_DIR}/some.patch` to select patches in the `port\<port>\` directory.
|
|
##
|
|
## ### QUIET
|
|
## Disables the warning message upon failure.
|
|
##
|
|
## This should only be used for edge cases, such as patches that are known to fail even on a clean source tree.
|
|
##
|
|
## ## Examples
|
|
##
|
|
## * [boost](https://github.com/Microsoft/vcpkg/blob/master/ports/boost/portfile.cmake)
|
|
## * [freetype](https://github.com/Microsoft/vcpkg/blob/master/ports/freetype/portfile.cmake)
|
|
## * [libpng](https://github.com/Microsoft/vcpkg/blob/master/ports/libpng/portfile.cmake)
|
|
|
|
function(vcpkg_apply_patches)
|
|
cmake_parse_arguments(_ap "QUIET" "SOURCE_PATH" "PATCHES" ${ARGN})
|
|
|
|
find_program(GIT NAMES git git.cmd)
|
|
set(PATCHNUM 0)
|
|
foreach(PATCH ${_ap_PATCHES})
|
|
get_filename_component(ABSOLUTE_PATCH "${PATCH}" ABSOLUTE BASE_DIR "${CURRENT_PORT_DIR}")
|
|
message(STATUS "Applying patch ${PATCH}")
|
|
set(LOGNAME patch-${TARGET_TRIPLET}-${PATCHNUM})
|
|
execute_process(
|
|
COMMAND ${GIT} --work-tree=. --git-dir=.git apply "${ABSOLUTE_PATCH}" --ignore-whitespace --whitespace=nowarn --verbose
|
|
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
|
|
)
|
|
|
|
if(error_code AND NOT _ap_QUIET)
|
|
message(STATUS "Applying patch failed. This is expected if this patch was previously applied.")
|
|
endif()
|
|
|
|
math(EXPR PATCHNUM "${PATCHNUM}+1")
|
|
endforeach()
|
|
endfunction()
|