Skip to content

Commit f31b624

Browse files
committed
Merge branch 'yw/cmake-updates'
CMake updates. * yw/cmake-updates: cmake: remove (_)UNICODE def on Windows in CMakeLists.txt cmake: add pcre2 support cmake: fix CMakeLists.txt on Linux
2 parents ab336e8 + 5ec7110 commit f31b624

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

contrib/buildsystems/CMakeLists.txt

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
5454

5555
option(USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies. Only applicable to Windows platforms" ON)
5656
if(NOT WIN32)
57-
set(USE_VCPKG OFF CACHE BOOL FORCE)
57+
set(USE_VCPKG OFF CACHE BOOL "" FORCE)
5858
endif()
5959

6060
if(NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
@@ -108,7 +108,6 @@ project(git
108108

109109
#TODO gitk git-gui gitweb
110110
#TODO Enable NLS on windows natively
111-
#TODO Add pcre support
112111

113112
#macros for parsing the Makefile for sources and scripts
114113
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
160159
find_package(Intl)
161160
endif()
162161

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+
163170
if(NOT Intl_FOUND)
164171
add_compile_definitions(NO_GETTEXT)
165172
if(NOT Iconv_FOUND)
@@ -180,6 +187,9 @@ endif()
180187
if(Intl_FOUND)
181188
include_directories(SYSTEM ${Intl_INCLUDE_DIRS})
182189
endif()
190+
if(PCRE2_FOUND)
191+
include_directories(SYSTEM ${PCRE2_INCLUDE_DIRS})
192+
endif()
183193

184194

185195
if(WIN32 AND NOT MSVC)#not required for visual studio builds
@@ -260,7 +270,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
260270
_CONSOLE DETECT_MSYS_TTY STRIP_EXTENSION=".exe" NO_SYMLINK_HEAD UNRELIABLE_FSTAT
261271
NOGDI OBJECT_CREATION_MODE=1 __USE_MINGW_ANSI_STDIO=0
262272
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)
264274
list(APPEND compat_SOURCES
265275
compat/mingw.c
266276
compat/winansi.c
@@ -277,7 +287,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
277287

278288
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
279289
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)
281291
endif()
282292

283293
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
@@ -700,6 +710,10 @@ endif()
700710
if(Iconv_FOUND)
701711
target_link_libraries(common-main ${Iconv_LIBRARIES})
702712
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()
703717
if(WIN32)
704718
target_link_libraries(common-main ws2_32 ntdll ${CMAKE_BINARY_DIR}/git.res)
705719
add_dependencies(common-main git-rc)

0 commit comments

Comments
 (0)