@@ -43,14 +43,27 @@ NOTE: By default CMake uses Makefile as the build tool on Linux and Visual Studi
43
43
to use another tool say `ninja` add this to the command line when configuring.
44
44
`-G Ninja`
45
45
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
+
46
49
]]
47
50
cmake_minimum_required (VERSION 3.14 )
48
51
49
52
#set the source directory to root of git
50
53
set (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 )
52
65
set (VCPKG_DIR "${CMAKE_SOURCE_DIR} /compat/vcbuild/vcpkg" )
53
- if (MSVC AND NOT EXISTS ${VCPKG_DIR} )
66
+ if (NOT EXISTS ${VCPKG_DIR} )
54
67
message ("Initializing vcpkg and building the Git's dependencies (this will take a while...)" )
55
68
execute_process (COMMAND ${CMAKE_SOURCE_DIR} /compat/vcbuild/vcpkg_install.bat )
56
69
endif ()
@@ -176,12 +189,18 @@ if(WIN32 AND NOT MSVC)#not required for visual studio builds
176
189
endif ()
177
190
endif ()
178
191
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 ()
185
204
endif ()
186
205
endif ()
187
206
@@ -982,7 +1001,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n"
982
1001
file (APPEND ${CMAKE_BINARY_DIR} /GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX} '\n " )
983
1002
file (APPEND ${CMAKE_BINARY_DIR} /GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON} '\n " )
984
1003
file (APPEND ${CMAKE_BINARY_DIR} /GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC} '\n " )
985
- if (WIN32 )
1004
+ if (USE_VCPKG )
986
1005
file (APPEND ${CMAKE_BINARY_DIR} /GIT-BUILD-OPTIONS "PATH=\" $PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n " )
987
1006
endif ()
988
1007
0 commit comments