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
This commit is contained in:
Dylan Van Assche
2022-07-25 09:18:29 +02:00
parent 041f53af8b
commit ba96ccc615
9 changed files with 57 additions and 10 deletions

View File

@@ -1,5 +1,12 @@
SUBDIRS = . dispatcher-connection dispatcher-fcc-unlock tests
SUBDIRS = \
. \
dispatcher-connection \
dispatcher-fcc-unlock
if WITH_TESTS
SUBDIRS += tests
endif
edit = @sed \
-e 's|@sbindir[@]|$(sbindir)|g' \

View File

@@ -1,7 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2021 Iñigo Martinez <inigomartinez@gmail.com>
subdir('tests')
if enable_tests
subdir('tests')
endif
service_conf = {
'sbindir': mm_prefix / mm_sbindir,