summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/gcrypt/meson.build13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/gcrypt/meson.build b/src/lib/gcrypt/meson.build
index 48297e279..5840bfe4d 100644
--- a/src/lib/gcrypt/meson.build
+++ b/src/lib/gcrypt/meson.build
@@ -1,4 +1,17 @@
+# Since version 0.49.0 Meson has native libgcrypt dependency support, which has
+# the advantage over find_library() as it uses libgcrypt-config to query the
+# required linker flags.
+# However, we still need to use find_library() first, to prevent Meson
+# falsly assuming a target libgcrypt is available in case there is no
+# libgcrypt-config entry in the cross file and libgcrypt is installed on the
+# host. In this case, Meson will falsly use the native libgcrypt-config and
+# will falsly assume it has found the gcrypt library for the target.
+#
+# See: https://github.com/MusicPlayerDaemon/MPD/pull/495
gcrypt_dep = c_compiler.find_library('gcrypt', required: get_option('qobuz'))
+if gcrypt_dep.found()
+ gcrypt_dep = dependency('libgcrypt')
+endif
if not gcrypt_dep.found()
subdir_done()
endif