@@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
54
54
55
55
option (USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies. Only applicable to Windows platforms" ON )
56
56
if (NOT WIN32 )
57
- set (USE_VCPKG OFF CACHE BOOL FORCE )
57
+ set (USE_VCPKG OFF CACHE BOOL "" FORCE )
58
58
endif ()
59
59
60
60
if (NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS )
@@ -108,7 +108,6 @@ project(git
108
108
109
109
#TODO gitk git-gui gitweb
110
110
#TODO Enable NLS on windows natively
111
- #TODO Add pcre support
112
111
113
112
#macros for parsing the Makefile for sources and scripts
114
113
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
160
159
find_package (Intl )
161
160
endif ()
162
161
162
+ find_package (PkgConfig )
163
+ if (PkgConfig_FOUND )
164
+ pkg_check_modules (PCRE2 libpcre2-8 )
165
+ if (PCRE2_FOUND )
166
+ add_compile_definitions (USE_LIBPCRE2 )
167
+ endif ()
168
+ endif ()
169
+
163
170
if (NOT Intl_FOUND )
164
171
add_compile_definitions (NO_GETTEXT )
165
172
if (NOT Iconv_FOUND )
@@ -180,6 +187,9 @@ endif()
180
187
if (Intl_FOUND )
181
188
include_directories (SYSTEM ${Intl_INCLUDE_DIRS} )
182
189
endif ()
190
+ if (PCRE2_FOUND )
191
+ include_directories (SYSTEM ${PCRE2_INCLUDE_DIRS} )
192
+ endif ()
183
193
184
194
185
195
if (WIN32 AND NOT MSVC )#not required for visual studio builds
@@ -260,7 +270,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
260
270
_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION= ".exe" NO_SYMLINK_HEAD UNRELIABLE_FSTAT
261
271
NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0
262
272
USE_NED_ALLOCATOR OVERRIDE_STRDUP MMAP_PREVENTS_DELETE USE_WIN32_MMAP
263
- UNICODE _UNICODE HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM )
273
+ HAVE_WPGMPTR ENSURE_MSYSTEM_IS_SET HAVE_RTLGENRANDOM )
264
274
list (APPEND compat_SOURCES
265
275
compat/mingw.c
266
276
compat/winansi.c
@@ -277,7 +287,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
277
287
278
288
elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
279
289
add_compile_definitions (PROCFS_EXECUTABLE_PATH= "/proc/self/exe" HAVE_DEV_TTY )
280
- list (APPEND compat_SOURCES unix -socket.c unix -stream-server.c )
290
+ list (APPEND compat_SOURCES unix -socket.c unix -stream-server.c compat/linux/procinfo.c )
281
291
endif ()
282
292
283
293
if (CMAKE_SYSTEM_NAME STREQUAL "Windows" )
@@ -700,6 +710,10 @@ endif()
700
710
if (Iconv_FOUND )
701
711
target_link_libraries (common-main ${Iconv_LIBRARIES} )
702
712
endif ()
713
+ if (PCRE2_FOUND )
714
+ target_link_libraries (common-main ${PCRE2_LIBRARIES} )
715
+ target_link_directories (common-main PUBLIC ${PCRE2_LIBRARY_DIRS} )
716
+ endif ()
703
717
if (WIN32 )
704
718
target_link_libraries (common-main ws2_32 ntdll ${CMAKE_BINARY_DIR} /git.res )
705
719
add_dependencies (common-main git-rc )
0 commit comments