build-tests: The allowed method is used by default
The allowed method returns true when the feature is set to `enabled`
or `auto`.
The allowed method returns false when the feature is set to
`disabled`.
So we prefer to use the `allowed` method instead of `enabled`.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I3cc28241cd9ef0d907aa73409a63a4470a628e70
diff --git a/meson.build b/meson.build
index b96658d..f1a65a8 100644
--- a/meson.build
+++ b/meson.build
@@ -90,8 +90,7 @@
install_dir: get_option('bindir')
)
-build_tests = get_option('tests')
-if not build_tests.disabled()
+if get_option('tests').allowed()
subdir('test')
endif
diff --git a/meson_options.txt b/meson_options.txt
index f862dfd..d626a88 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,6 @@
option(
'tests', type : 'feature',
+ value: 'enabled',
description : 'Build tests'
)