Do not build tests for release
Some checks failed
Build ptprnt / build (push) Failing after 36s

This commit is contained in:
2025-10-19 12:33:17 +02:00
parent caa5b7a279
commit c94505dc0d
5 changed files with 33 additions and 14 deletions

View File

@@ -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