@@ -43,14 +43,27 @@ NOTE: By default CMake uses Makefile as the build tool on Linux and Visual Studi
4343to use another tool say `ninja` add this to the command line when configuring.
4444`-G Ninja`
4545
46+ NOTE: By default CMake will install vcpkg locally to your source tree on configuration,
47+ to avoid this, add `-DNO_VCPKG=TRUE` to the command line when configuring.
48+
4649]]
4750cmake_minimum_required (VERSION 3.14)
4851
4952#set the source directory to root of git
5053set (CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR} /../..)
51- if (WIN32 )
54+
55+ option (USE_VCPKG "Whether or not to use vcpkg for obtaining dependencies. Only applicable to Windows platforms" ON )
56+ if (NOT WIN32 )
57+ set (USE_VCPKG OFF CACHE BOOL FORCE)
58+ endif ()
59+
60+ if (NOT DEFINED CMAKE_EXPORT_COMPILE_COMMANDS)
61+ set (CMAKE_EXPORT_COMPILE_COMMANDS TRUE )
62+ endif ()
63+
64+ if (USE_VCPKG)
5265 set (VCPKG_DIR "${CMAKE_SOURCE_DIR} /compat/vcbuild/vcpkg" )
53- if (MSVC AND NOT EXISTS ${VCPKG_DIR} )
66+ if (NOT EXISTS ${VCPKG_DIR} )
5467 message ("Initializing vcpkg and building the Git's dependencies (this will take a while...)" )
5568 execute_process (COMMAND ${CMAKE_SOURCE_DIR} /compat/vcbuild/vcpkg_install.bat)
5669 endif ()
@@ -176,12 +189,18 @@ if(WIN32 AND NOT MSVC)#not required for visual studio builds
176189 endif ()
177190endif ()
178191
179- find_program (MSGFMT_EXE msgfmt)
180- if (NOT MSGFMT_EXE)
181- set (MSGFMT_EXE ${CMAKE_SOURCE_DIR} /compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
182- if (NOT EXISTS ${MSGFMT_EXE} )
183- message (WARNING "Text Translations won't be built" )
184- unset (MSGFMT_EXE)
192+ if (NO_GETTEXT)
193+ message (STATUS "msgfmt not used under NO_GETTEXT" )
194+ else ()
195+ find_program (MSGFMT_EXE msgfmt)
196+ if (NOT MSGFMT_EXE)
197+ if (USE_VCPKG)
198+ set (MSGFMT_EXE ${CMAKE_SOURCE_DIR} /compat/vcbuild/vcpkg/downloads/tools/msys2/msys64/usr/bin/msgfmt.exe)
199+ endif ()
200+ if (NOT EXISTS ${MSGFMT_EXE} )
201+ message (WARNING "Text Translations won't be built" )
202+ unset (MSGFMT_EXE)
203+ endif ()
185204 endif ()
186205endif ()
187206
@@ -982,7 +1001,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n"
9821001file (APPEND ${CMAKE_BINARY_DIR} /GIT-BUILD -OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX} '\n " )
9831002file (APPEND ${CMAKE_BINARY_DIR} /GIT-BUILD -OPTIONS "NO_PYTHON='${NO_PYTHON} '\n " )
9841003file (APPEND ${CMAKE_BINARY_DIR} /GIT-BUILD -OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC} '\n " )
985- if (WIN32 )
1004+ if (USE_VCPKG )
9861005 file (APPEND ${CMAKE_BINARY_DIR} /GIT-BUILD -OPTIONS "PATH=\" $PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n " )
9871006endif ()
9881007
0 commit comments