list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: "Yuyi Wang via GitGitGadget" <>
Cc: Derrick Stolee <>,
	Yuyi Wang <>,
	Yuyi Wang <>
Subject: [PATCH v2 2/2] Add pcre2 support for cmake build system.
Date: Tue, 24 May 2022 06:38:48 +0000	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

From: Yuyi Wang <>

This commit fixes one of the TODOs listed in the CMakeLists.txt.

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

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 <>
 contrib/buildsystems/CMakeLists.txt | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 7f333e303c2..2844dd6c88d 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)
+	pkg_check_modules(PCRE2 libpcre2-8)
+		add_compile_definitions(USE_LIBPCRE2)
+	endif()
 if(NOT Intl_FOUND)
 	if(NOT Iconv_FOUND)
@@ -180,6 +187,9 @@ endif()
 	include_directories(SYSTEM ${Intl_INCLUDE_DIRS})
+	include_directories(SYSTEM ${PCRE2_INCLUDE_DIRS})
 if(WIN32 AND NOT MSVC)#not required for visual studio builds
@@ -700,6 +710,10 @@ endif()
 	target_link_libraries(common-main ${Iconv_LIBRARIES})
+	target_link_libraries(common-main ${PCRE2_LIBRARIES})
+	target_link_directories(common-main PUBLIC ${PCRE2_LIBRARY_DIRS})
 	target_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)
 	add_dependencies(common-main git-rc)

      parent reply	other threads:[~2022-05-24  6:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18  3:58 [PATCH] Add pcre2 support for cmake build system Yuyi Wang via GitGitGadget
2022-05-18 22:02 ` Junio C Hamano
2022-05-19 16:18   ` Yuyi Wang
2022-05-23 18:35     ` Derrick Stolee
2022-05-23 18:36   ` Derrick Stolee
2022-05-24  6:38 ` [PATCH v2 0/2] " Yuyi Wang via GitGitGadget
2022-05-24  6:38   ` [PATCH v2 1/2] Fix CMakeLists.txt on Linux Yuyi Wang via GitGitGadget
2022-05-24 23:04     ` Junio C Hamano
2022-05-24  6:38   ` Yuyi Wang via GitGitGadget [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).