Skip to content

Commit bc69624

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 a1dbd69 commit bc69624

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
@@ -814,15 +814,19 @@ list(TRANSFORM git_shell_scripts PREPEND "${CMAKE_BINARY_DIR}/")
814814
list(TRANSFORM git_perl_scripts PREPEND "${CMAKE_BINARY_DIR}/")
815815

816816
#install
817-
install(TARGETS git git-shell
817+
foreach(program ${PROGRAMS_BUILT})
818+
if(${program} STREQUAL git OR ${program} STREQUAL git-shell)
819+
install(TARGETS ${program}
818820
RUNTIME DESTINATION bin)
821+
else()
822+
install(TARGETS ${program}
823+
RUNTIME DESTINATION libexec/git-core)
824+
endif()
825+
endforeach()
826+
819827
install(PROGRAMS ${CMAKE_BINARY_DIR}/git-cvsserver
820828
DESTINATION bin)
821829

822-
list(REMOVE_ITEM PROGRAMS_BUILT git git-shell)
823-
install(TARGETS ${PROGRAMS_BUILT}
824-
RUNTIME DESTINATION libexec/git-core)
825-
826830
set(bin_links
827831
git-receive-pack git-upload-archive git-upload-pack)
828832

0 commit comments

Comments
 (0)