summaryrefslogtreecommitdiff
path: root/tests/meson.build
diff options
context:
space:
mode:
authorPhaedrus Leeds <mwleeds@protonmail.com>2022-05-10 17:34:21 +0000
committerPhaedrus Leeds <mwleeds@protonmail.com>2022-05-10 17:34:21 +0000
commit72e532d7edd0219b20f391f6dc63533e75a445cf (patch)
treef0b85783954d4c3ff1c6ce2a319c1d09aa389914 /tests/meson.build
parentc71f7aefa142c444210f1021d1af42f365ec3a7b (diff)
parent238f7bfc494e16a0864f88ae891da6e7b3d82e5b (diff)
downloadlibglnx-72e532d7edd0219b20f391f6dc63533e75a445cf.tar.gz
Merge branch 'wip/smcv/subproject' into 'master'
Improve Meson subproject support See merge request GNOME/libglnx!34
Diffstat (limited to 'tests/meson.build')
-rw-r--r--tests/meson.build62
1 files changed, 41 insertions, 21 deletions
diff --git a/tests/meson.build b/tests/meson.build
index 2ad8c44..2c38ab0 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -2,25 +2,45 @@
# Copyright 2019 Collabora Ltd.
# SPDX-License-Identifier: LGPL-2.1-or-later
-test_names = [
- 'errors',
- 'fdio',
- 'macros',
- 'shutil',
- 'xattrs',
-]
+libglnx_testlib = static_library(
+ 'glnx-testlib',
+ 'libglnx-testlib.c',
+ 'libglnx-testlib.h',
+ dependencies : [
+ libglnx_dep,
+ libglnx_deps,
+ ],
+ install : false,
+)
+libglnx_testlib_dep = declare_dependency(
+ dependencies : [
+ libglnx_dep,
+ libglnx_deps,
+ ],
+ include_directories : include_directories('.'),
+ link_with : libglnx_testlib,
+)
-foreach test_name : test_names
- exe = executable(test_name,
- [
- 'libglnx-testlib.c',
- 'libglnx-testlib.h',
- 'test-libglnx-' + test_name + '.c',
- ],
- dependencies: [
- libglnx_dep,
- libglnx_deps,
- ],
- )
- test(test_name, exe)
-endforeach
+if get_option('tests')
+ test_names = [
+ 'errors',
+ 'fdio',
+ 'macros',
+ 'shutil',
+ 'xattrs',
+ ]
+
+ foreach test_name : test_names
+ exe = executable(test_name,
+ [
+ 'test-libglnx-' + test_name + '.c',
+ ],
+ dependencies: [
+ libglnx_dep,
+ libglnx_deps,
+ libglnx_testlib_dep,
+ ],
+ )
+ test(test_name, exe)
+ endforeach
+endif