Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuyi Wang <Strawberry_Str@hotmail.com>2022-05-24 09:38:48 +0300
committerJunio C Hamano <gitster@pobox.com>2022-05-25 02:05:21 +0300
commit80431510a2b97e08bd577f39934e2b5ea9a43034 (patch)
treed575e10ff69887402f4bb404a10b109b4ce2af6b /contrib
parenta561962479cc2c1063babeeaf0e6491fd4b8b2e8 (diff)
cmake: add pcre2 support
Fix one of the TODOs listed in the CMakeLists.txt by adding support for building with pcre2. As pcre2 doesn't provide cmake find module, we find it with pkgconf. This patch also works with vcpkg on Windows, with pkgconf and pcre2 installed. Pkgconf and pcre2 is detected automatically just like curl, expat and iconv. The output of CMake indicates whether pcre2 is found. Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/buildsystems/CMakeLists.txt16
1 files changed, 15 insertions, 1 deletions
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 7f333e303c..2844dd6c88 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -108,7 +108,6 @@ project(git
#TODO gitk git-gui gitweb
#TODO Enable NLS on windows natively
-#TODO Add pcre support
#macros for parsing the Makefile for sources and scripts
macro(parse_makefile_for_sources list_var regex)
@@ -160,6 +159,14 @@ if(NOT (WIN32 AND (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_COMPILER_ID ST
find_package(Intl)
endif()
+find_package(PkgConfig)
+if(PkgConfig_FOUND)
+ pkg_check_modules(PCRE2 libpcre2-8)
+ if(PCRE2_FOUND)
+ add_compile_definitions(USE_LIBPCRE2)
+ endif()
+endif()
+
if(NOT Intl_FOUND)
add_compile_definitions(NO_GETTEXT)
if(NOT Iconv_FOUND)
@@ -180,6 +187,9 @@ endif()
if(Intl_FOUND)
include_directories(SYSTEM ${Intl_INCLUDE_DIRS})
endif()
+if(PCRE2_FOUND)
+ include_directories(SYSTEM ${PCRE2_INCLUDE_DIRS})
+endif()
if(WIN32 AND NOT MSVC)#not required for visual studio builds
@@ -700,6 +710,10 @@ endif()
if(Iconv_FOUND)
target_link_libraries(common-main ${Iconv_LIBRARIES})
endif()
+if(PCRE2_FOUND)
+ target_link_libraries(common-main ${PCRE2_LIBRARIES})
+ target_link_directories(common-main PUBLIC ${PCRE2_LIBRARY_DIRS})
+endif()
if(WIN32)
target_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)
add_dependencies(common-main git-rc)