diff --git a/cmake/SelectRegex.cmake b/cmake/SelectRegex.cmake index f2a41b593..5dbd8182e 100644 --- a/cmake/SelectRegex.cmake +++ b/cmake/SelectRegex.cmake @@ -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") diff --git a/deps/pcre2/CMakeLists.txt b/deps/pcre2/CMakeLists.txt index 90fe0dbd8..a282c99b2 100644 --- a/deps/pcre2/CMakeLists.txt +++ b/deps/pcre2/CMakeLists.txt @@ -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) diff --git a/deps/pcre2/pcre2.h b/deps/pcre2/pcre2.h index 3a129f059..e97c1693b 100644 --- a/deps/pcre2/pcre2.h +++ b/deps/pcre2/pcre2.h @@ -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) diff --git a/deps/pcre2/pcre2_internal.h b/deps/pcre2/pcre2_internal.h index 83c8cfe47..aa7940957 100644 --- a/deps/pcre2/pcre2_internal.h +++ b/deps/pcre2/pcre2_internal.h @@ -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)