aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhoebe <20694052+PhoebeHui@users.noreply.github.com>2020-10-27 08:44:56 +0800
committerGitHub <noreply@github.com>2020-10-26 17:44:56 -0700
commitd0695f6709dd0b3fedf17e3f24e046b167918030 (patch)
tree17ff260d2a7a10bd21a9d7a606b082ab45646b7c
parente9f8cc67a5e5541973e53ac03f88adb45cc1b21b (diff)
downloadvcpkg-d0695f6709dd0b3fedf17e3f24e046b167918030.tar.gz
vcpkg-d0695f6709dd0b3fedf17e3f24e046b167918030.zip
[pcre] Export cmake targets (#13539)
-rw-r--r--ports/pcre/CONTROL2
-rw-r--r--ports/pcre/export-cmake-targets.patch25
-rw-r--r--ports/pcre/portfile.cmake9
-rw-r--r--ports/pcre/unofficial-pcre-config.cmake1
4 files changed, 34 insertions, 3 deletions
diff --git a/ports/pcre/CONTROL b/ports/pcre/CONTROL
index cbd70b869..5f42aa89d 100644
--- a/ports/pcre/CONTROL
+++ b/ports/pcre/CONTROL
@@ -1,5 +1,5 @@
Source: pcre
Version: 8.44
-Port-Version: 7
+Port-Version: 8
Homepage: https://www.pcre.org/
Description: Perl Compatible Regular Expressions
diff --git a/ports/pcre/export-cmake-targets.patch b/ports/pcre/export-cmake-targets.patch
new file mode 100644
index 000000000..ef89070dd
--- /dev/null
+++ b/ports/pcre/export-cmake-targets.patch
@@ -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)
+
diff --git a/ports/pcre/portfile.cmake b/ports/pcre/portfile.cmake
index 6175b0bbb..2cb9fce34 100644
--- a/ports/pcre/portfile.cmake
+++ b/ports/pcre/portfile.cmake
@@ -4,7 +4,8 @@ set(PATCHES
# Fix CMake Deprecation Warning concerning OLD behavior for policy CMP0026
# Suppress MSVC compiler warnings C4703, C4146, C4308, which fixes errors
# 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
URLS "https://ftp.pcre.org/pub/pcre/pcre-${PCRE_VERSION}.zip"
@@ -53,6 +54,8 @@ vcpkg_configure_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)
file(READ ${FILE} PCRE_H)
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}/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)
-vcpkg_copy_pdbs()
diff --git a/ports/pcre/unofficial-pcre-config.cmake b/ports/pcre/unofficial-pcre-config.cmake
new file mode 100644
index 000000000..edf30b977
--- /dev/null
+++ b/ports/pcre/unofficial-pcre-config.cmake
@@ -0,0 +1 @@
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-pcre-targets.cmake")