[pcre] Export cmake targets (#13539)

This commit is contained in:
Phoebe 2020-10-27 08:44:56 +08:00 committed by GitHub
parent e9f8cc67a5
commit d0695f6709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 3 deletions

View File

@ -1,5 +1,5 @@
Source: pcre Source: pcre
Version: 8.44 Version: 8.44
Port-Version: 7 Port-Version: 8
Homepage: https://www.pcre.org/ Homepage: https://www.pcre.org/
Description: Perl Compatible Regular Expressions Description: Perl Compatible Regular Expressions

View File

@ -0,0 +1,25 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 252de6e..bcef3ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -885,10 +885,19 @@ ENDIF(PCRE_BUILD_TESTS)
# Installation
SET(CMAKE_INSTALL_ALWAYS 1)
-INSTALL(TARGETS ${targets}
+foreach(target ${targets})
+ INSTALL(TARGETS ${target}
+ EXPORT pcre-targets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
+ target_include_directories(${target} PUBLIC $<INSTALL_INTERFACE:include>)
+endforeach()
+
+INSTALL(EXPORT pcre-targets
+ NAMESPACE unofficial::pcre::
+ FILE unofficial-pcre-targets.cmake
+ DESTINATION "share/unofficial-pcre")
INSTALL(FILES ${PCRE_HEADERS} ${PCREPOSIX_HEADERS} DESTINATION include)

View File

@ -4,7 +4,8 @@ set(PATCHES
# Fix CMake Deprecation Warning concerning OLD behavior for policy CMP0026 # Fix CMake Deprecation Warning concerning OLD behavior for policy CMP0026
# Suppress MSVC compiler warnings C4703, C4146, C4308, which fixes errors # Suppress MSVC compiler warnings C4703, C4146, C4308, which fixes errors
# under x64-uwp and arm-uwp # under x64-uwp and arm-uwp
pcre-8.44_suppress_cmake_and_compiler_warnings-errors.patch) pcre-8.44_suppress_cmake_and_compiler_warnings-errors.patch
export-cmake-targets.patch)
vcpkg_download_distfile(ARCHIVE vcpkg_download_distfile(ARCHIVE
URLS "https://ftp.pcre.org/pub/pcre/pcre-${PCRE_VERSION}.zip" URLS "https://ftp.pcre.org/pub/pcre/pcre-${PCRE_VERSION}.zip"
@ -53,6 +54,8 @@ vcpkg_configure_cmake(
vcpkg_install_cmake() vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-${PORT} TARGET_PATH share/unofficial-${PORT})
foreach(FILE ${CURRENT_PACKAGES_DIR}/include/pcre.h ${CURRENT_PACKAGES_DIR}/include/pcreposix.h) foreach(FILE ${CURRENT_PACKAGES_DIR}/include/pcre.h ${CURRENT_PACKAGES_DIR}/include/pcreposix.h)
file(READ ${FILE} PCRE_H) file(READ ${FILE} PCRE_H)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
@ -121,6 +124,8 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/man)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/man) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/man)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc)
vcpkg_copy_pdbs()
configure_file(${CMAKE_CURRENT_LIST_DIR}/unofficial-pcre-config.cmake ${CURRENT_PACKAGES_DIR}/share/unofficial-pcre/unofficial-pcre-config.cmake @ONLY)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_copy_pdbs()

View File

@ -0,0 +1 @@
include("${CMAKE_CURRENT_LIST_DIR}/unofficial-pcre-targets.cmake")