blob: 39835d222c74e0b3f44ab2f76cdc7a2ee2664db7 [file] [log] [blame]
John Chunge2fae4b2024-11-13 18:10:31 -06001gtest = 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,
Patrick Williamsce3e4872025-03-03 11:07:48 -05009 required: false,
John Chunge2fae4b2024-11-13 18:10:31 -060010 )
11 if gtest_proj.found()
12 gtest = declare_dependency(
13 dependencies: [
14 dependency('threads'),
15 gtest_proj.dependency('gtest'),
16 gtest_proj.dependency('gtest_main'),
Patrick Williamsce3e4872025-03-03 11:07:48 -050017 ],
18 )
John Chunge2fae4b2024-11-13 18:10:31 -060019 gmock = gtest_proj.dependency('gmock')
20 else
21 assert(not get_option('tests').enabled(), 'Googletest is required')
22 endif
23endif
24
25# Build/add serial_unittest to test suite
Patrick Williamsce3e4872025-03-03 11:07:48 -050026test(
27 'transport_serial',
John Chunge2fae4b2024-11-13 18:10:31 -060028 executable(
29 'transport_serial_unittest',
30 'serial_unittest.cpp',
31 '../serialcmd.cpp',
32 include_directories: root_inc,
33 build_by_default: false,
34 implicit_include_directories: false,
35 dependencies: [
36 sdbusplus_dep,
37 stdplus_dep,
38 phosphor_logging_dep,
39 sdeventplus_dep,
40 gtest,
Patrick Williamsce3e4872025-03-03 11:07:48 -050041 gmock,
42 ],
43 ),
John Chunge2fae4b2024-11-13 18:10:31 -060044)