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() |
William A. Kennington III | 159a356 | 2021-02-04 15:00:41 -0800 | [diff] [blame] | 4 | gtest_proj = import('cmake').subproject( |
| 5 | 'googletest', |
| 6 | cmake_options: [ |
| 7 | '-DCMAKE_CXX_FLAGS=-Wno-pedantic', |
| 8 | ], |
| 9 | required: false) |
William A. Kennington III | bbd1b56 | 2020-02-20 15:15:19 -0800 | [diff] [blame] | 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 build_tests.enabled(), 'Googletest is required') |
| 20 | endif |
| 21 | endif |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 22 | |
William A. Kennington III | 159a356 | 2021-02-04 15:00:41 -0800 | [diff] [blame] | 23 | |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 24 | tests = [ |
| 25 | 'clock', |
| 26 | 'event', |
| 27 | 'exception', |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 28 | 'source/base', |
| 29 | 'source/child', |
| 30 | 'source/event', |
| 31 | 'source/io', |
| 32 | 'source/signal', |
| 33 | 'source/time', |
| 34 | 'utility/timer', |
| 35 | ] |
| 36 | |
| 37 | foreach t : tests |
| 38 | test(t, executable(t.underscorify(), t + '.cpp', |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 39 | implicit_include_directories: false, |
Patrick Williams | fc18eb0 | 2021-04-15 14:55:58 -0500 | [diff] [blame^] | 40 | dependencies: [sdeventplus_dep, gtest, gmock])) |
William A. Kennington III | d4b33e9 | 2018-12-04 17:22:05 -0800 | [diff] [blame] | 41 | endforeach |