blob: 4fccb10564a1df3c9e0c5d92226c660a1c75ab90 [file] [log] [blame]
William A. Kennington III48d6b062023-07-26 14:38:56 -07001gtest = dependency('gtest', main: true, disabler: true, required: false)
2gmock = dependency('gmock', disabler: true, required: false)
3if not gtest.found() or not gmock.found()
4 gtest_opts = import('cmake').subproject_options()
5 gtest_opts.add_cmake_defines({'CMAKE_CXX_FLAGS': '-Wno-pedantic'})
6 gtest_proj = import('cmake').subproject(
7 'googletest',
8 options: gtest_opts,
9 required: false)
10 if gtest_proj.found()
11 gtest = declare_dependency(
12 dependencies: [
13 dependency('threads'),
14 gtest_proj.dependency('gtest'),
15 gtest_proj.dependency('gtest_main'),
16 ])
17 gmock = gtest_proj.dependency('gmock')
18 else
19 assert(not get_option('tests').enabled(), 'Googletest is required')
20 endif
21endif
Patrick Williamseb887012023-07-21 10:00:49 -050022
William A. Kennington III48d6b062023-07-26 14:38:56 -070023gtests = {
24 'ethstats': [ethstats_dep, gmock, gtest],
25}
26
27foreach t, deps : gtests
28 test(
29 t,
30 executable(
31 t.underscorify(), t + '.cpp',
32 build_by_default: false,
33 implicit_include_directories: false,
34 cpp_args: '-Wno-missing-braces',
35 dependencies: deps))
36endforeach