blob: f4f79007344a4ffc32a91d66aecc66b2463564e0 [file] [log] [blame]
Jason M. Billsd6087ae2023-10-09 11:54:13 -07001gtest_dep = dependency('gtest', main: true, disabler: true, required: false)
2gmock_dep = dependency('gmock', disabler: true, required: false)
3if not gtest_dep.found() or not gmock_dep.found()
4 gtest_proj = import('cmake').subproject('googletest', required: false)
5 if gtest_proj.found()
6 gtest_dep = declare_dependency(
7 dependencies: [
8 dependency('threads'),
9 gtest_proj.dependency('gtest'),
10 gtest_proj.dependency('gtest_main'),
11 ]
12 )
13 gmock_dep = gtest_proj.dependency('gmock')
14 else
15 assert(
16 not get_option('tests').enabled(),
17 'Googletest is required if tests are enabled'
18 )
19 endif
20endif
21
22unit_tests = [
23]
24
25if get_option('tests').enabled()
26 # generate the test executable
27 foreach unit_test : unit_tests
28 test(unit_test, executable(
29 unit_test,
30 unit_test + '.cpp',
31 include_directories: incs,
32 dependencies: deps + [
33 gtest_dep,
34 gmock_dep,
35 ])
36 )
37 endforeach
38endif