Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
f0cb3788
Commit
f0cb3788
authored
Nov 10, 2021
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: refactor regex selection
Move regex selection into its own cmake module.
parent
de178d36
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
52 deletions
+52
-52
cmake/SelectRegex.cmake
+51
-0
src/CMakeLists.txt
+1
-52
No files found.
cmake/SelectRegex.cmake
0 → 100644
View file @
f0cb3788
# Specify regular expression implementation
find_package
(
PCRE
)
if
(
REGEX_BACKEND STREQUAL
""
)
check_symbol_exists
(
regcomp_l
"regex.h;xlocale.h"
HAVE_REGCOMP_L
)
if
(
HAVE_REGCOMP_L
)
set
(
REGEX_BACKEND
"regcomp_l"
)
elseif
(
PCRE_FOUND
)
set
(
REGEX_BACKEND
"pcre"
)
else
()
set
(
REGEX_BACKEND
"builtin"
)
endif
()
endif
()
if
(
REGEX_BACKEND STREQUAL
"regcomp_l"
)
add_feature_info
(
regex ON
"using system regcomp_l"
)
set
(
GIT_REGEX_REGCOMP_L 1
)
elseif
(
REGEX_BACKEND 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
}
)
list
(
APPEND LIBGIT2_PC_REQUIRES
"libpcre2-8"
)
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
}
)
list
(
APPEND LIBGIT2_PC_REQUIRES
"libpcre"
)
elseif
(
REGEX_BACKEND STREQUAL
"regcomp"
)
add_feature_info
(
regex ON
"using system regcomp"
)
set
(
GIT_REGEX_REGCOMP 1
)
elseif
(
REGEX_BACKEND STREQUAL
"builtin"
)
add_feature_info
(
regex ON
"using bundled PCRE"
)
set
(
GIT_REGEX_BUILTIN 1
)
add_subdirectory
(
"
${
libgit2_SOURCE_DIR
}
/deps/pcre"
"
${
libgit2_BINARY_DIR
}
/deps/pcre"
)
list
(
APPEND LIBGIT2_INCLUDES
"
${
libgit2_SOURCE_DIR
}
/deps/pcre"
)
list
(
APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:pcre>
)
else
()
message
(
FATAL_ERROR
"The REGEX_BACKEND option provided is not supported"
)
endif
()
src/CMakeLists.txt
View file @
f0cb3788
...
@@ -114,61 +114,10 @@ endif()
...
@@ -114,61 +114,10 @@ endif()
include
(
SelectHTTPSBackend
)
include
(
SelectHTTPSBackend
)
include
(
SelectHashes
)
include
(
SelectHashes
)
include
(
SelectHTTPParser
)
include
(
SelectHTTPParser
)
include
(
SelectRegex
)
target_sources
(
git2internal PRIVATE
${
SRC_SHA1
}
)
target_sources
(
git2internal PRIVATE
${
SRC_SHA1
}
)
# Specify regular expression implementation
find_package
(
PCRE
)
if
(
REGEX_BACKEND STREQUAL
""
)
check_symbol_exists
(
regcomp_l
"regex.h;xlocale.h"
HAVE_REGCOMP_L
)
if
(
HAVE_REGCOMP_L
)
set
(
REGEX_BACKEND
"regcomp_l"
)
elseif
(
PCRE_FOUND
)
set
(
REGEX_BACKEND
"pcre"
)
else
()
set
(
REGEX_BACKEND
"builtin"
)
endif
()
endif
()
if
(
REGEX_BACKEND STREQUAL
"regcomp_l"
)
add_feature_info
(
regex ON
"using system regcomp_l"
)
set
(
GIT_REGEX_REGCOMP_L 1
)
elseif
(
REGEX_BACKEND 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
}
)
list
(
APPEND LIBGIT2_PC_REQUIRES
"libpcre2-8"
)
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
}
)
list
(
APPEND LIBGIT2_PC_REQUIRES
"libpcre"
)
elseif
(
REGEX_BACKEND STREQUAL
"regcomp"
)
add_feature_info
(
regex ON
"using system regcomp"
)
set
(
GIT_REGEX_REGCOMP 1
)
elseif
(
REGEX_BACKEND STREQUAL
"builtin"
)
add_feature_info
(
regex ON
"using bundled PCRE"
)
set
(
GIT_REGEX_BUILTIN 1
)
add_subdirectory
(
"
${
libgit2_SOURCE_DIR
}
/deps/pcre"
"
${
libgit2_BINARY_DIR
}
/deps/pcre"
)
list
(
APPEND LIBGIT2_INCLUDES
"
${
libgit2_SOURCE_DIR
}
/deps/pcre"
)
list
(
APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:pcre>
)
else
()
message
(
FATAL_ERROR
"The REGEX_BACKEND option provided is not supported"
)
endif
()
# Optional external dependency: zlib
# Optional external dependency: zlib
SanitizeBool
(
USE_BUNDLED_ZLIB
)
SanitizeBool
(
USE_BUNDLED_ZLIB
)
if
(
USE_BUNDLED_ZLIB STREQUAL ON
)
if
(
USE_BUNDLED_ZLIB STREQUAL ON
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment