blob: 07807c4f7fa6ef086fa7606db56b2d519147fb40 [file] [log] [blame]
kasunath7ffd30a2022-05-10 18:11:34 -07001gtest = dependency('gtest', main: true, disabler: true, required: get_option('tests'))
2gmock = dependency('gmock', disabler: true, required: get_option('tests'))
3
4if not gtest.found() or not gmock.found()
5 gtest_proj = import('cmake').subproject('googletest', required: false)
6 if gtest_proj.found()
7 gtest = declare_dependency(
8 dependencies: [
9 gtest_proj.dependency('gtest'),
10 gtest_proj.dependency('gtest_main'),
11 ])
12 gmock = gtest_proj.dependency('gmock')
13 else
14 assert(not get_option('tests').enabled(), 'Googletest is required')
15 endif
16endif
17
18gtests = [
kasunathe8946af2022-05-23 12:32:09 -070019 'bej_decoder',
kasunath0aa36d82022-11-23 14:24:15 -080020 'bej_common',
kasunathd073aa12022-05-12 16:08:49 -070021 'bej_dictionary',
kasunath2ebe82f2023-01-31 13:59:22 -080022 'bej_tree',
kasunath7ffd30a2022-05-10 18:11:34 -070023]
24foreach t : gtests
25 test(t, executable(t.underscorify(), t + '_test.cpp',
26 build_by_default: false,
27 implicit_include_directories: false,
28 dependencies: [libbej, gtest, gmock]))
29endforeach