Skip to content

Commit 6ea6016

Browse files
PhilipOakleydscho
authored andcommitted
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 .vcxproj project files needed for some extension tools. Inform users of the additional .sln/.vcxproj generation. ** How to test: rm -rf '.vs' # remove old visual studio settings rm -rf 'compat/vcbuild/vcpkg' # remove any vcpkg downloads rm -rf 'contrib/buildsystems/out' # remove builds & CMake artifacts 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 235cdc1 commit 6ea6016

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

contrib/buildsystems/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -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)