Skip to content

Commit e8772a7

Browse files
dschogitster
authored andcommitted
cmake: add a preparatory work-around to accommodate vcpkg
We are about to add support for installing the `.dll` files of Git's dependencies (such as libcurl) in the CMake configuration. The `vcpkg` ecosystem from which we get said dependencies makes that relatively easy: simply turn on `X_VCPKG_APPLOCAL_DEPS_INSTALL`. However, current `vcpkg` introduces a limitation if one does that: While it is totally cool with CMake to specify multiple targets within one invocation of `install(TARGETS ...) (at least according to https://cmake.org/cmake/help/latest/command/install.html#command:install), `vcpkg`'s parser insists on a single target per `install(TARGETS ...)` invocation. Well, that's easily accomplished: Let's feed the targets individually to the `install(TARGETS ...)` function in a `foreach()` look. This also has the advantage that we do not have to manually cull off the two entries from the `${PROGRAMS_BUILT}` array before scheduling the remainder to be installed into `libexec/git-core`. Instead, we iterate through the array and decide for each entry where it wants to go. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 569f8d1 commit e8772a7

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)