vcpkg/ports/poco/0007-find-pcre2.patch

107 lines
3.4 KiB
Diff
Raw Normal View History

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f05f50c..bb7a94c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -494,6 +494,11 @@ install(
Devel
)
+if(POCO_UNBUNDLED)
+ install(FILES cmake/FindPCRE2.cmake
+ DESTINATION "${PocoConfigPackageLocation}")
+endif()
+
message(STATUS "CMake ${CMAKE_VERSION} successfully configured ${PROJECT_NAME} using ${CMAKE_GENERATOR} generator")
message(STATUS "${PROJECT_NAME} package version: ${PROJECT_VERSION}")
if(BUILD_SHARED_LIBS)
diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt
index 226dadb..25ff2c1 100644
--- a/Foundation/CMakeLists.txt
+++ b/Foundation/CMakeLists.txt
@@ -35,8 +35,11 @@ POCO_MESSAGES(SRCS Logging src/pocomsg.mc)
# If POCO_UNBUNDLED is enabled we try to find the required packages
# The configuration will fail if the packages are not found
if(POCO_UNBUNDLED)
- find_package(PCRE2 REQUIRED)
find_package(ZLIB REQUIRED)
+ include(SelectLibraryConfigurations)
+ find_library(PCRE2_LIBRARY_DEBUG NAMES pcre2-8d pcre2-8-staticd HINTS ${INSTALLED_LIB_PATH})
+ find_library(PCRE2_LIBRARY_RELEASE NAMES pcre2-8 pcre2-8-static HINTS ${INSTALLED_LIB_PATH})
+ select_library_configurations(PCRE2)
#HACK: Unicode.cpp requires functions from these files. The can't be taken from the library
POCO_SOURCES(SRCS RegExp
@@ -107,7 +110,7 @@ set_target_properties(Foundation
)
if(POCO_UNBUNDLED)
- target_link_libraries(Foundation PUBLIC Pcre2::Pcre2 ZLIB::ZLIB)
+ target_link_libraries(Foundation PUBLIC ${PCRE2_LIBRARY} ZLIB::ZLIB)
target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED)
add_definitions(
-D_pcre2_utf8_table1=_poco_pcre2_utf8_table1
diff --git a/cmake/FindPCRE2.cmake b/cmake/FindPCRE2.cmake
index e730f32..6e10df2 100644
--- a/cmake/FindPCRE2.cmake
+++ b/cmake/FindPCRE2.cmake
@@ -54,7 +54,7 @@ Hints
include(FindPackageHandleStandardArgs)
find_package(PkgConfig QUIET)
-pkg_check_modules(PC_PCRE2 QUIET pcre2)
+pkg_check_modules(PC_PCRE2 QUIET libpcre2-8)
find_path(PCRE2_INCLUDE_DIR
NAMES pcre2.h
@@ -66,8 +66,8 @@ find_path(PCRE2_INCLUDE_DIR
DOC "Specify the include directory containing pcre2.h"
)
-find_library(PCRE2_LIBRARY
- NAMES pcre2-8
+find_library(PCRE2_LIBRARY_DEBUG
+ NAMES pcre2-8d pcre2-8-staticd
HINTS
${PCRE2_ROOT_DIR}/lib
${PCRE2_ROOT_LIBRARY_DIRS}
@@ -76,6 +76,19 @@ find_library(PCRE2_LIBRARY
DOC "Specify the lib directory containing pcre2"
)
+find_library(PCRE2_LIBRARY_RELEASE
+ NAMES pcre2-8 pcre2-8-static
+ HINTS
+ ${PCRE2_ROOT_DIR}/lib
+ ${PCRE2_ROOT_LIBRARY_DIRS}
+ PATHS
+ ${PC_PCRE2_LIBRARY_DIRS}
+ DOC "Specify the lib directory containing pcre2"
+)
+
+include(SelectLibraryConfigurations)
+select_library_configurations(PCRE2)
+
set(PCRE2_VERSION ${PC_PCRE2_VERSION})
find_package_handle_standard_args(PCRE2
@@ -87,7 +100,6 @@ find_package_handle_standard_args(PCRE2
)
if(PCRE2_FOUND)
- set(PCRE2_LIBRARIES ${PCRE2_LIBRARY})
set(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR})
set(PCRE2_DEFINITIONS ${PC_PCRE2_CFLAGS_OTHER})
endif()
diff --git a/cmake/PocoConfig.cmake.in b/cmake/PocoConfig.cmake.in
index 4864b32..90f68fc 100644
--- a/cmake/PocoConfig.cmake.in
+++ b/cmake/PocoConfig.cmake.in
@@ -10,7 +10,6 @@ endif()
include(CMakeFindDependencyMacro)
find_dependency(ZLIB REQUIRED)
-#find_dependency(unofficial-pcre REQUIRED)
if(Poco_FIND_REQUIRED_XML)
find_dependency(expat CONFIG REQUIRED)
endif()