Skip to content

Commit 3f7c02e

Browse files
committed
cmake: work around recent vcpkg update
In f1f5dff (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 ecf7ee3 (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 <worktree>/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): <worktree>/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 microsoft/vcpkg@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 <[email protected]>
1 parent ef51fd3 commit 3f7c02e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

contrib/buildsystems/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -811,15 +811,19 @@ list(TRANSFORM git_shell_scripts PREPEND "${CMAKE_BINARY_DIR}/")
811811
list(TRANSFORM git_perl_scripts PREPEND "${CMAKE_BINARY_DIR}/")
812812

813813
#install
814-
install(TARGETS git git-shell
814+
foreach(program ${PROGRAMS_BUILT})
815+
if(program STREQUAL "git" OR program STREQUAL "git-shell")
816+
install(TARGETS ${program}
815817
RUNTIME DESTINATION bin)
818+
else()
819+
install(TARGETS ${program}
820+
RUNTIME DESTINATION libexec/git-core)
821+
endif()
822+
endforeach()
823+
816824
install(PROGRAMS ${CMAKE_BINARY_DIR}/git-cvsserver
817825
DESTINATION bin)
818826

819-
list(REMOVE_ITEM PROGRAMS_BUILT git git-shell)
820-
install(TARGETS ${PROGRAMS_BUILT}
821-
RUNTIME DESTINATION libexec/git-core)
822-
823827
set(bin_links
824828
git-receive-pack git-upload-archive git-upload-pack)
825829

0 commit comments

Comments
 (0)