From bc69624f5f0385c7a6e59fc600ffe6c398e5e927 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 24 Feb 2021 22:10:23 +0100 Subject: [PATCH] cmake: work around recent `vcpkg` update In f1f5dff9e7c (cmake: installation support for git, 2020-06-26), we added support for the CMake equivalent of `make install` that makes use of multiple targets within one invocation of `install(TARGETS ...). This is totally fine according to CMake's documentation at https://cmake.org/cmake/help/latest/command/install.html#command:install). And this was still fine even after ecf7ee3cd5a (cmake(install): include vcpkg dlls, 2021-01-08) where we started to use `vcpkg`'s CMake scripts to ensure that the `.dll` files of Git's dependencies are also installed. However, with a recent update of `vcpkg`, the handling of local dependencies was changed in a way that is incompatible with our CMake definition. The symptom looks like this: CMake Error at /compat/vcbuild/vcpkg/scripts/buildsystems/vcpkg.cmake:734 (get_target_property): get_target_property() called with non-existent target "git;git-shell". Call Stack (most recent call first): /compat/vcbuild/vcpkg/scripts/buildsystems/vcpkg.cmake:784 (x_vcpkg_install_local_dependencies) CMakeLists.txt:821 (install) The apparent reason for this breakage is that the `vcpkg` changes in https://github.com/microsoft/vcpkg/commit/1bb5ea10a3 no longer allows an arbitrary number of targets to be specified in `install(TARGETS ...)`. Let's work around this by feeding the target individually to the `install(TARGETS ...)` function. Signed-off-by: Johannes Schindelin --- contrib/buildsystems/CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index b45db9e548..79932fa7a7 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -814,15 +814,19 @@ list(TRANSFORM git_shell_scripts PREPEND "${CMAKE_BINARY_DIR}/") list(TRANSFORM git_perl_scripts PREPEND "${CMAKE_BINARY_DIR}/") #install -install(TARGETS git git-shell +foreach(program ${PROGRAMS_BUILT}) +if(${program} STREQUAL git OR ${program} STREQUAL git-shell) +install(TARGETS ${program} RUNTIME DESTINATION bin) +else() +install(TARGETS ${program} + RUNTIME DESTINATION libexec/git-core) +endif() +endforeach() + install(PROGRAMS ${CMAKE_BINARY_DIR}/git-cvsserver DESTINATION bin) -list(REMOVE_ITEM PROGRAMS_BUILT git git-shell) -install(TARGETS ${PROGRAMS_BUILT} - RUNTIME DESTINATION libexec/git-core) - set(bin_links git-receive-pack git-upload-archive git-upload-pack)