meson: stop linking libcurl into all executables

We set up libcurl via the `libgit_dependencies` variable, which gets propagated into every user of the `libgit` dependency. This is not necessary though, as most of our executables aren't even supposed to link against libcurl. Fix this by only propagating include directories as a libgit dependency and propagating the full curl dependency via `libgit_curl`. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Feb 26, 2025 at 09:22 UTC f5fac42e07cc7152ee29d656c8af6dbfb10e92e4
1 file changed +4 -2
meson.build
+4 -2
@@ -927,7 +927,9 @@ if curl.found()
927 use_curl_for_imap_send = true
928 endif
929
930 - libgit_dependencies += curl
930 + # Most executables don't have to link against libcurl, but we still need its
931 + # include directories so that we can resolve LIBCURL_VERSION in "help.c".
932 + libgit_dependencies += curl.partial_dependency(includes: true)
933 libgit_c_args += '-DCURL_DISABLE_TYPECHECK'
934 build_options_config.set('NO_CURL', '')
935 else
@@ -1666,7 +1668,7 @@ if get_option('curl').enabled()
1668 'http.c',
1669 'http-walker.c',
1670 ],
1669 - dependencies: [libgit_commonmain],
1671 + dependencies: [libgit_commonmain, curl],
1672 )
1673
1674 test_dependencies += executable('git-remote-http',