William A. Kennington III | bbd1b56 | 2020-02-20 15:15:19 -0800 | [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_proj = import('cmake').subproject('googletest', required: false) |
| 5 | if gtest_proj.found() |
| 6 | gtest = declare_dependency( |
| 7 | dependencies: [ |
| 8 | dependency('threads'), |
| 9 | gtest_proj.dependency('gtest'), |
| 10 | gtest_proj.dependency('gtest_main'), |
| 11 | ]) |
| 12 | gmock = gtest_proj.dependency('gmock') |
| 13 | else |
| 14 | assert(not build_tests.enabled(), 'Googletest is required') |
| 15 | endif |
| 16 | endif |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 17 | |
| 18 | tests = [ |
| 19 | 'clock', |
| 20 | 'event', |
| 21 | 'exception', |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 22 | 'internal/utils', |
| 23 | 'source/base', |
| 24 | 'source/child', |
| 25 | 'source/event', |
| 26 | 'source/io', |
| 27 | 'source/signal', |
| 28 | 'source/time', |
| 29 | 'utility/timer', |
| 30 | ] |
| 31 | |
| 32 | foreach t : tests |
| 33 | test(t, executable(t.underscorify(), t + '.cpp', |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 34 | implicit_include_directories: false, |
William A. Kennington III | 8ec59e6 | 2019-04-03 13:38:17 -0700 | [diff] [blame] | 35 | dependencies: [sdeventplus, gtest, gmock])) |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 36 | endforeach |