git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>
Subject: [PATCH v2 3/4] cmake: add a preparatory work-around to accommodate `vcpkg`
Date: Mon, 29 Mar 2021 12:41:44 +0000	[thread overview]
Message-ID: <5d953a21e9bd6b5da562c9d285159bda2289b4fa.1617021705.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.887.v2.git.1617021705.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

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 <johannes.schindelin@gmx.de>
---
 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 da2811ae3aad..3b94b5f62109 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -811,15 +811,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)
 
-- 
gitgitgadget


  parent reply	other threads:[~2021-03-29 12:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-27 23:06 [PATCH 0/4] cmake: learn to optionally skip linking dashed built-ins Johannes Schindelin via GitGitGadget
2021-03-27 23:06 ` [PATCH 1/4] cmake: support SKIP_DASHED_BUILT_INS Johannes Schindelin via GitGitGadget
2021-03-27 23:06 ` [PATCH 2/4] cmake(install): fix double .exe suffixes Dennis Ameling via GitGitGadget
2021-03-27 23:06 ` [PATCH 3/4] cmake: add a preparatory work-around to accommodate `vcpkg` Johannes Schindelin via GitGitGadget
2021-03-28  3:19   ` Đoàn Trần Công Danh
2021-03-29 13:36     ` Johannes Schindelin
2021-03-27 23:06 ` [PATCH 4/4] cmake(install): include vcpkg dlls Dennis Ameling via GitGitGadget
2021-03-29 12:41 ` [PATCH v2 0/4] cmake: learn to optionally skip linking dashed built-ins Johannes Schindelin via GitGitGadget
2021-03-29 12:41   ` [PATCH v2 1/4] cmake: support SKIP_DASHED_BUILT_INS Johannes Schindelin via GitGitGadget
2021-03-29 12:41   ` [PATCH v2 2/4] cmake(install): fix double .exe suffixes Dennis Ameling via GitGitGadget
2021-03-29 12:41   ` Johannes Schindelin via GitGitGadget [this message]
2021-03-29 12:41   ` [PATCH v2 4/4] cmake(install): include vcpkg dlls Dennis Ameling via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5d953a21e9bd6b5da562c9d285159bda2289b4fa.1617021705.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=congdanhqx@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).