Commit ac2b235e by Edward Thomson

regex: use REGEX_BACKEND as the cmake option name

This avoids any misunderstanding with the REGEX keyword in cmake.
parent ce6d624a
......@@ -65,7 +65,7 @@ OPTION(DEBUG_POOL "Enable debug pool allocator" OFF)
OPTION(ENABLE_WERROR "Enable compilation with -Werror" OFF)
OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib" OFF)
OPTION(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF)
SET(REGEX "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
SET(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
IF (UNIX AND NOT APPLE)
OPTION(ENABLE_REPRODUCIBLE_BUILDS "Enable reproducible builds" OFF)
......
......@@ -292,22 +292,22 @@ ENDIF()
# Specify regular expression implementation
FIND_PACKAGE(PCRE)
IF(REGEX STREQUAL "")
IF(REGEX_BACKEND STREQUAL "")
CHECK_SYMBOL_EXISTS(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
IF(HAVE_REGCOMP_L)
SET(REGEX "regcomp_l")
SET(REGEX_BACKEND "regcomp_l")
ELSEIF(PCRE_FOUND)
SET(REGEX "pcre")
SET(REGEX_BACKEND "pcre")
ELSE()
SET(REGEX "builtin")
SET(REGEX_BACKEND "builtin")
ENDIF()
ENDIF()
IF(REGEX STREQUAL "regcomp_l")
IF(REGEX_BACKEND STREQUAL "regcomp_l")
ADD_FEATURE_INFO(regex ON "using system regcomp_l")
SET(GIT_REGEX_REGCOMP_L 1)
ELSEIF(REGEX STREQUAL "pcre2")
ELSEIF(REGEX_BACKEND STREQUAL "pcre2")
FIND_PACKAGE(PCRE2)
IF(NOT PCRE2_FOUND)
......@@ -319,16 +319,16 @@ ELSEIF(REGEX STREQUAL "pcre2")
LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE2_INCLUDE_DIRS})
LIST(APPEND LIBGIT2_LIBS ${PCRE2_LIBRARIES})
ELSEIF(REGEX STREQUAL "pcre")
ELSEIF(REGEX_BACKEND STREQUAL "pcre")
ADD_FEATURE_INFO(regex ON "using system PCRE")
SET(GIT_REGEX_PCRE 1)
LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${PCRE_INCLUDE_DIRS})
LIST(APPEND LIBGIT2_LIBS ${PCRE_LIBRARIES})
ELSEIF(REGEX STREQUAL "regcomp")
ELSEIF(REGEX_BACKEND STREQUAL "regcomp")
ADD_FEATURE_INFO(regex ON "using system regcomp")
SET(GIT_REGEX_REGCOMP 1)
ELSEIF(REGEX STREQUAL "builtin")
ELSEIF(REGEX_BACKEND STREQUAL "builtin")
ADD_FEATURE_INFO(regex ON "using bundled PCRE")
SET(GIT_REGEX_BUILTIN 1)
......@@ -336,7 +336,7 @@ ELSEIF(REGEX STREQUAL "builtin")
LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/pcre")
LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:pcre>)
ELSE()
MESSAGE(FATAL_ERROR "The REGEX option provided is not supported")
MESSAGE(FATAL_ERROR "The REGEX_BACKEND option provided is not supported")
ENDIF()
# Optional external dependency: http-parser
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment