From 726c11148105a97aef39bec024fdb7c140b1b154 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Mon, 7 Oct 2019 19:35:13 +0200 Subject: [vcpkg] fatal_error when patch fails to apply (#8087) vcpkg will now fail on failure to apply patches except when using `--head`. --- scripts/cmake/vcpkg_apply_patches.cmake | 2 +- scripts/cmake/vcpkg_common_definitions.cmake | 3 +++ scripts/cmake/vcpkg_extract_source_archive_ex.cmake | 19 ++++++++++++++++++- scripts/cmake/vcpkg_fixup_cmake_targets.cmake | 2 ++ scripts/cmake/vcpkg_from_github.cmake | 1 + 5 files changed, 25 insertions(+), 2 deletions(-) (limited to 'scripts/cmake') diff --git a/scripts/cmake/vcpkg_apply_patches.cmake b/scripts/cmake/vcpkg_apply_patches.cmake index 9698917de..8957fca27 100644 --- a/scripts/cmake/vcpkg_apply_patches.cmake +++ b/scripts/cmake/vcpkg_apply_patches.cmake @@ -49,7 +49,7 @@ function(vcpkg_apply_patches) ) if(error_code AND NOT _ap_QUIET) - message(STATUS "Applying patch failed. This is expected if this patch was previously applied.") + message(FATAL_ERROR "Applying patch failed. Patch needs to be updated to work with source being used by vcpkg!") endif() math(EXPR PATCHNUM "${PATCHNUM}+1") diff --git a/scripts/cmake/vcpkg_common_definitions.cmake b/scripts/cmake/vcpkg_common_definitions.cmake index 28177fbbf..60afeaf36 100644 --- a/scripts/cmake/vcpkg_common_definitions.cmake +++ b/scripts/cmake/vcpkg_common_definitions.cmake @@ -55,6 +55,7 @@ endif() #Helper variables for libraries if(VCPKG_TARGET_IS_WINDOWS) set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".lib") + set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib") set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dll") set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX ".lib") set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "") @@ -69,6 +70,7 @@ if(VCPKG_TARGET_IS_WINDOWS) #set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "") elseif(VCPKG_TARGET_IS_OSX) set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a") + set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "") set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".dylib") set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib") set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib") @@ -76,6 +78,7 @@ elseif(VCPKG_TARGET_IS_OSX) set(VCPKG_FIND_LIBRARY_PREFIXES "lib" "") else() set(VCPKG_TARGET_STATIC_LIBRARY_SUFFIX ".a") + set(VCPKG_TARGET_IMPORT_LIBRARY_SUFFIX "") set(VCPKG_TARGET_SHARED_LIBRARY_SUFFIX ".so") set(VCPKG_TARGET_STATIC_LIBRARY_PREFIX "lib") set(VCPKG_TARGET_SHARED_LIBRARY_PREFIX "lib") diff --git a/scripts/cmake/vcpkg_extract_source_archive_ex.cmake b/scripts/cmake/vcpkg_extract_source_archive_ex.cmake index a775c2094..67916d09d 100644 --- a/scripts/cmake/vcpkg_extract_source_archive_ex.cmake +++ b/scripts/cmake/vcpkg_extract_source_archive_ex.cmake @@ -5,6 +5,7 @@ ## ## Usage ## ```cmake ## vcpkg_extract_source_archive_ex( +## SKIP_PATCH_CHECK ## OUT_SOURCE_PATH ## ARCHIVE <${ARCHIVE}> ## [REF <1.0.0>] @@ -14,6 +15,9 @@ ## ) ## ``` ## ## Parameters +## ### SKIP_PATCH_CHECK +## If this option is set the failure to apply a patch is ignored. +## ## ### OUT_SOURCE_PATH ## Specifies the out-variable that will contain the extracted location. ## @@ -51,7 +55,13 @@ include(vcpkg_apply_patches) include(vcpkg_extract_source_archive) function(vcpkg_extract_source_archive_ex) - cmake_parse_arguments(_vesae "NO_REMOVE_ONE_LEVEL" "OUT_SOURCE_PATH;ARCHIVE;REF;WORKING_DIRECTORY" "PATCHES" ${ARGN}) + cmake_parse_arguments( + _vesae + "NO_REMOVE_ONE_LEVEL;SKIP_PATCH_CHECK" + "OUT_SOURCE_PATH;ARCHIVE;REF;WORKING_DIRECTORY" + "PATCHES" + ${ARGN} + ) if(NOT _vesae_ARCHIVE) message(FATAL_ERROR "Must specify ARCHIVE parameter to vcpkg_extract_source_archive_ex()") @@ -115,7 +125,14 @@ function(vcpkg_extract_source_archive_ex) endif() endif() + if (_vesae_SKIP_PATCH_CHECK) + set (QUIET QUIET) + else() + set (QUIET) + endif() + vcpkg_apply_patches( + ${QUIET} SOURCE_PATH ${TEMP_SOURCE_PATH} PATCHES ${_vesae_PATCHES} ) diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake index 3b5370bcd..c383fcb56 100644 --- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake +++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake @@ -178,3 +178,5 @@ function(vcpkg_fixup_cmake_targets) file(WRITE ${CMAKE_FILE} "${_contents}") endforeach() endfunction() + + diff --git a/scripts/cmake/vcpkg_from_github.cmake b/scripts/cmake/vcpkg_from_github.cmake index c0d657bbc..a822ee40e 100644 --- a/scripts/cmake/vcpkg_from_github.cmake +++ b/scripts/cmake/vcpkg_from_github.cmake @@ -172,6 +172,7 @@ function(vcpkg_from_github) endif() vcpkg_extract_source_archive_ex( + SKIP_PATCH_CHECK OUT_SOURCE_PATH SOURCE_PATH ARCHIVE "${downloaded_file_path}" REF "${SANITIZED_HEAD_REF}" -- cgit v1.2.3