Use PCRE2_STATIC for bundled regex linkage

This commit is contained in:
copilot-swe-agent[bot]
2026-05-31 09:28:30 +00:00
committed by GitHub
parent f84035e156
commit f4acefaba4
4 changed files with 2 additions and 10 deletions

View File

@@ -55,6 +55,7 @@ elseif(USE_REGEX STREQUAL "regcomp")
elseif(USE_REGEX STREQUAL "builtin")
add_feature_info("Regular expressions" ON "using bundled implementation")
set(GIT_REGEX_BUILTIN 1)
add_definitions(-DPCRE2_STATIC)
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/pcre2" "${PROJECT_BINARY_DIR}/deps/pcre2")
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/pcre2")

View File

@@ -103,6 +103,7 @@ set(PCRE2POSIX_SOURCES pcre2posix.c)
add_definitions(-DHAVE_CONFIG_H)
add_definitions(-DPCRE2_CODE_UNIT_WIDTH=8)
add_definitions(-DPCRE2_STATIC)
if(MSVC)
add_compile_definitions(_CRT_SECURE_NO_DEPRECATE _CRT_SECURE_NO_WARNINGS)

5
deps/pcre2/pcre2.h vendored
View File

@@ -53,11 +53,6 @@ don't change existing definitions of PCRE2_EXP_DECL.
By default, we use the standard "extern" declarations. */
/* libgit2 uses pcre2 as an object library */
#if defined(__MINGW32__)
# define PCRE2_EXP_DECL
#endif
#ifndef PCRE2_EXP_DECL
# if defined(_WIN32) && !defined(PCRE2_STATIC)
# define PCRE2_EXP_DECL extern __declspec(dllimport)

View File

@@ -151,11 +151,6 @@ only if it is not already set. */
#error This project uses C99. C++ is not supported.
#endif
/* libgit2 uses pcre2 as an object library */
#if defined(__MINGW32__)
# define PCRE2_EXP_DECL
#endif
#ifndef PCRE2_EXP_DECL
# if defined(_WIN32) && !defined(PCRE2_STATIC)
# define PCRE2_EXP_DECL extern __declspec(dllexport)