This commit is contained in:
23
meson.build
23
meson.build
@@ -63,13 +63,20 @@ ptprnt_exe = executable(
|
||||
)
|
||||
|
||||
### Unit tests
|
||||
# Only build tests for debug builds or when explicitly enabled
|
||||
build_tests = get_option('buildtype') == 'debug' or get_option('build_tests')
|
||||
|
||||
# GTest and GMock
|
||||
gtest_proj = subproject('gtest')
|
||||
gtest_dep = gtest_proj.get_variable('gtest_main_dep')
|
||||
gmock_dep = gtest_proj.get_variable('gmock_main_dep')
|
||||
if not gtest_dep.found()
|
||||
error('MESON_SKIP_TEST: gtest not installed.')
|
||||
endif
|
||||
if build_tests
|
||||
# GTest and GMock
|
||||
gtest_proj = subproject('gtest')
|
||||
gtest_dep = gtest_proj.get_variable('gtest_main_dep')
|
||||
gmock_dep = gtest_proj.get_variable('gmock_main_dep')
|
||||
if not gtest_dep.found()
|
||||
error('MESON_SKIP_TEST: gtest not installed.')
|
||||
endif
|
||||
|
||||
subdir('tests')
|
||||
subdir('tests')
|
||||
message('Tests enabled (buildtype=' + get_option('buildtype') + ')')
|
||||
else
|
||||
message('Tests disabled (use debug build or -Dbuild_tests=true to enable)')
|
||||
endif
|
||||
Reference in New Issue
Block a user