Skip to content

Commit 128e2bf

Browse files
committed
CMakeLists: add default "x64-windows" arch for Visual Studio
In Git-for-Windows, work on using ARM64 has progressed. The commit 2d94b77 (cmake: allow building for Windows/ARM64, 2020-12-04) failed to notice that /compat/vcbuild/vcpkg_install.bat will default to using the "x64-windows" architecture for the vcpkg installation if not set, but CMake is not told of this default. Commit 635b6d9 (vcbuild: install ARM64 dependencies when building ARM64 binaries, 2020-01-31) later updated vcpkg_install.bat to accept an arch (%1) parameter, but retained the default. This default is neccessary for the use case where the project directory is opened directly in Visual Studio, which will find and build a CMakeLists.txt file without any parameters, thus expecting use of the default setting. Also Visual studio will generate internal .sln solution and .vcproj project files needed for some extension tools. Inform users of the additional .sln/.vcproj generation. ** How to test: rm -rf '.vs' # remove old visual studio settings rm -rf 'compat/vcbuild/vcpkg' # remove any vcpkg downloads with a fresh Visual Studio Community Edition, File>>Open>>(git *folder*) to load the project (which will take some time!). check for successful compilation. The implicit .sln (etc.) are in the hidden .vs directory created by Visual Studio. Signed-off-by: Philip Oakley <[email protected]>
1 parent 2ff7fcd commit 128e2bf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

contrib/buildsystems/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Instructions to run CMake manually:
2727
2828
This will build the git binaries in contrib/buildsystems/out
2929
directory (our top-level .gitignore file knows to ignore contents of
30-
this directory).
30+
this directory). The project .sln and .vcproj files are also generated.
3131
3232
Possible build configurations(-DCMAKE_BUILD_TYPE) with corresponding
3333
compiler flags
@@ -71,6 +71,10 @@ if(USE_VCPKG)
7171
message("Initializing vcpkg and building the Git's dependencies (this will take a while...)")
7272
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/compat/vcbuild/vcpkg_install.bat ${VCPKG_ARCH})
7373
endif()
74+
if(NOT EXISTS ${VCPKG_ARCH})
75+
message("VCPKG_ARCH: unset, using 'x64-windows'")
76+
set(VCPKG_ARCH "x64-windows") # default from vcpkg_install.bat
77+
endif()
7478
list(APPEND CMAKE_PREFIX_PATH "${VCPKG_DIR}/installed/${VCPKG_ARCH}")
7579

7680
# In the vcpkg edition, we need this to be able to link to libcurl

0 commit comments

Comments
 (0)