diff options
author | Dylan Van Assche <me@dylanvanassche.be> | 2022-07-25 09:18:29 +0200 |
---|---|---|
committer | Dylan Van Assche <me@dylanvanassche.be> | 2022-07-25 11:01:51 +0200 |
commit | ba96ccc61587b7b6c31b94826ee7a3c44d795364 (patch) | |
tree | 6924ba6a4cd89c8500a9e7826074df5b23616b65 /meson.build | |
parent | 041f53af8b138fda6242ad1381fd3cd1c2ff6c81 (diff) |
build: make tests optional
Add a meson option -Dtests and --without-tests automake option
to disable the compilation of all available testcases.
This is useful for compiling projects with Flatpak such as
GNOME Control Center which disables all possible integrations since they
only need the DBus part of ModemManager.
Contributes to https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1392
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/meson.build b/meson.build index f656d357..0f6ae409 100644 --- a/meson.build +++ b/meson.build @@ -88,6 +88,9 @@ cc_args = cc.get_supported_arguments([ '-Wno-missing-field-initializers', ]) +# tests are enabled by default +enable_tests = get_option('tests') + # strict flags to use in debug builds if get_option('buildtype').contains('debug') cc_args += cc.get_supported_arguments([ @@ -266,7 +269,9 @@ if dist_version != '' config_h.set('MM_DIST_VERSION', dist_version) endif -util_dep = cc.find_library('util') +if enable_tests + util_dep = cc.find_library('util') +endif # introspection support enable_gir = get_option('introspection') @@ -376,14 +381,19 @@ subdir('introspection') subdir('include') subdir('libqcdm/src') -subdir('libqcdm/tests') +if enable_tests + subdir('libqcdm/tests') +endif subdir('libmm-glib') subdir('src') subdir('plugins') subdir('cli') -subdir('test') -subdir('tools/tests') + +if enable_tests + subdir('test') + subdir('tools/tests') +endif subdir('examples/sms-c') |