regex: use REGEX_BACKEND as the cmake option name This avoids any misunderstanding with the REGEX keyword in cmake.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
diff --git a/CMakeLists.txt b/CMakeLists.txt
index de7e53c..1630a7b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cd4c688..e1815fd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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