summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÍñigo Huguet <inigohuguet@hotmail.com>2024-04-02 12:59:12 +0000
committerÍñigo Huguet <inigohuguet@hotmail.com>2024-04-02 12:59:12 +0000
commit1556bf385515b295165d65188554191f46c849ae (patch)
tree591472afa525c17cbbd5d2350379f28b7d5fdd08
parentd534f984f7033d3a77f51baee01dccb50f55800a (diff)
parentf57513097ffc8672dabba54550b1b960947dd99c (diff)
merge: branch 'ih/meson-qt-auto'
meson: autodetect Qt dependencies https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1906
-rw-r--r--meson.build19
-rw-r--r--meson_options.txt2
2 files changed, 12 insertions, 9 deletions
diff --git a/meson.build b/meson.build
index d01adea11e..b39b4cf453 100644
--- a/meson.build
+++ b/meson.build
@@ -961,14 +961,17 @@ test(
subdir('examples/C/glib')
enable_qt = get_option('qt')
-if enable_qt
- add_languages('cpp')
-
- qt_core_dep = dependency('QtCore', version: '>= 4')
- qt_dbus_dep = dependency('QtDBus')
- qt_network_dep = dependency('QtNetwork')
-
- subdir('examples/C/qt')
+if enable_qt != 'false'
+ qt_core_dep = dependency('QtCore', version: '>= 4', required: enable_qt == 'yes')
+ qt_dbus_dep = dependency('QtDBus', required: enable_qt == 'yes')
+ qt_network_dep = dependency('QtNetwork', required: enable_qt == 'yes')
+
+ # If enable_qt=='yes' we have all the dependencies. If it's 'auto', skip
+ # building the Qt examples if any dependency is missing.
+ if qt_core_dep.found() and qt_dbus_dep.found() and qt_network_dep.found()
+ add_languages('cpp')
+ subdir('examples/C/qt')
+ endif
endif
if enable_docs
diff --git a/meson_options.txt b/meson_options.txt
index 4f796615b3..92439ac539 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -74,5 +74,5 @@ option('valgrind_suppressions', type: 'string', value: '', description: 'Use spe
option('ld_gc', type: 'boolean', value: true, description: 'Enable garbage collection of unused symbols on linking')
option('libpsl', type: 'boolean', value: true, description: 'Link against libpsl')
option('crypto', type: 'combo', choices: ['nss', 'gnutls', 'null'], value: 'nss', description: 'Cryptography library to use for certificate and key operations')
-option('qt', type: 'boolean', value: true, description: 'enable Qt examples')
+option('qt', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'enable Qt examples')
option('readline', type: 'combo', choices: ['auto', 'libreadline', 'libedit', 'none'], description: 'Using readline (auto) or libedit)')