summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2019-05-19 10:30:04 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2019-05-19 11:12:13 +0100
commitce6d624af223a855a83664106957d4453dd56fcd (patch)
treec1fff540e70b150f993ae208bb5da7e84d3d9fb2 /src/CMakeLists.txt
parent69ecdad5a494957afcf2447cc6edac6934f2b1b6 (diff)
downloadlibgit2-ce6d624af223a855a83664106957d4453dd56fcd.tar.gz
regex: optionally use PCRE2
Use PCRE2 and its POSIX compatibility layer if requested by the user. Although PCRE2 is adequate for our needs, the PCRE2 POSIX layer as installed on Debian and Ubuntu systems is broken, so we do not opt-in to it by default to avoid breaking users on those platforms.
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 852a2af24..cd4c68800 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -307,6 +307,18 @@ ENDIF()
IF(REGEX STREQUAL "regcomp_l")
ADD_FEATURE_INFO(regex ON "using system regcomp_l")
SET(GIT_REGEX_REGCOMP_L 1)
+ELSEIF(REGEX STREQUAL "pcre2")
+ FIND_PACKAGE(PCRE2)
+
+ IF(NOT PCRE2_FOUND)
+ MESSAGE(FATAL_ERROR "PCRE2 support was requested but not found")
+ ENDIF()
+
+ ADD_FEATURE_INFO(regex ON "using system PCRE2")
+ SET(GIT_REGEX_PCRE2 1)
+
+ LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE2_INCLUDE_DIRS})
+ LIST(APPEND LIBGIT2_LIBS ${PCRE2_LIBRARIES})
ELSEIF(REGEX STREQUAL "pcre")
ADD_FEATURE_INFO(regex ON "using system PCRE")
SET(GIT_REGEX_PCRE 1)