John Chung | e2fae4b | 2024-11-13 18:10:31 -0600 | [diff] [blame^] | 1 | gtest = dependency('gtest', main: true, disabler: true, required: false) |
| 2 | gmock = dependency('gmock', disabler: true, required: false) |
| 3 | if 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 | ) |
| 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'), |
| 17 | ]) |
| 18 | gmock = gtest_proj.dependency('gmock') |
| 19 | else |
| 20 | assert(not get_option('tests').enabled(), 'Googletest is required') |
| 21 | endif |
| 22 | endif |
| 23 | |
| 24 | # Build/add serial_unittest to test suite |
| 25 | test('transport_serial', |
| 26 | executable( |
| 27 | 'transport_serial_unittest', |
| 28 | 'serial_unittest.cpp', |
| 29 | '../serialcmd.cpp', |
| 30 | include_directories: root_inc, |
| 31 | build_by_default: false, |
| 32 | implicit_include_directories: false, |
| 33 | dependencies: [ |
| 34 | sdbusplus_dep, |
| 35 | stdplus_dep, |
| 36 | phosphor_logging_dep, |
| 37 | sdeventplus_dep, |
| 38 | gtest, |
| 39 | gmock |
| 40 | ] |
| 41 | ) |
| 42 | ) |