Added support for system PCRE2
This will allow system PCRE2 to be used instead of always using the bundled one.
This commit is contained in:
@ -42,9 +42,15 @@ find_package(Git)
|
|||||||
find_package(CURL)
|
find_package(CURL)
|
||||||
find_package(RabbitMQ)
|
find_package(RabbitMQ)
|
||||||
|
|
||||||
# Build PCRE2
|
# Find or build PCRE2
|
||||||
# Read BuildPCRE2 for details about how to add pcre2 as a dependency to a target
|
# Read BuildPCRE2 for details about how to add pcre2 as a dependency to a target
|
||||||
include(cmake/BuildPCRE2.cmake)
|
find_package(PCRE2)
|
||||||
|
if(NOT PCRE2_FOUND)
|
||||||
|
message(STATUS "Using bundled PCRE2 library")
|
||||||
|
include(cmake/BuildPCRE2.cmake)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include_directories(${PCRE2_INCLUDE_DIRS})
|
||||||
|
|
||||||
# If the connector was not found, download and build it from source
|
# If the connector was not found, download and build it from source
|
||||||
if(NOT MARIADB_CONNECTOR_FOUND)
|
if(NOT MARIADB_CONNECTOR_FOUND)
|
||||||
|
@ -14,5 +14,6 @@ ExternalProject_Add(pcre2 SOURCE_DIR ${CMAKE_SOURCE_DIR}/pcre2/
|
|||||||
BUILD_COMMAND make
|
BUILD_COMMAND make
|
||||||
INSTALL_COMMAND "")
|
INSTALL_COMMAND "")
|
||||||
|
|
||||||
include_directories(${CMAKE_BINARY_DIR}/pcre2/)
|
set(PCRE2_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/pcre2/ CACHE PATH "PCRE2 headers" FORCE)
|
||||||
set(PCRE2_LIBRARIES ${CMAKE_BINARY_DIR}/pcre2/libpcre2-8.a CACHE INTERNAL "")
|
set(PCRE2_LIBRARIES ${CMAKE_BINARY_DIR}/pcre2/libpcre2-8.a CACHE PATH "PCRE2 libraries" FORCE)
|
||||||
|
set(PCRE2_FOUND TRUE CACHE BOOL "Found PCRE2 libraries" FORCE)
|
||||||
|
17
cmake/FindPCRE2.cmake
Normal file
17
cmake/FindPCRE2.cmake
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# This CMake file tries to find the Perl regular expression libraries
|
||||||
|
# The following variables are set:
|
||||||
|
# PCRE2_FOUND - System has the PCRE library
|
||||||
|
# PCRE2_LIBRARIES - The PCRE library file
|
||||||
|
# PCRE2_INCLUDE_DIRS - The folder with the PCRE headers
|
||||||
|
|
||||||
|
find_library(PCRE2_LIBRARIES NAMES pcre2 pcre2-8)
|
||||||
|
find_path(PCRE2_INCLUDE_DIRS pcre2.h)
|
||||||
|
if(PCRE2_LIBRARIES AND PCRE2_INCLUDE_DIRS)
|
||||||
|
message(STATUS "PCRE2 libs: ${PCRE2_LIBRARIES}")
|
||||||
|
message(STATUS "PCRE2 include directory: ${PCRE2_INCLUDE_DIRS}")
|
||||||
|
set(PCRE2_FOUND TRUE CACHE BOOL "Found PCRE2 libraries" FORCE)
|
||||||
|
add_custom_target(pcre2)
|
||||||
|
else()
|
||||||
|
set(PCRE2_FOUND FALSE CACHE BOOL "Found PCRE2 libraries" FORCE)
|
||||||
|
message(STATUS "PCRE2 library not found.")
|
||||||
|
endif()
|
Reference in New Issue
Block a user