William A. Kennington III | 3f43b7e | 2021-02-16 16:54:40 -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( |
| 5 | 'googletest', |
| 6 | cmake_options: [ |
| 7 | '-DCMAKE_CXX_FLAGS=-Wno-pedantic', |
| 8 | ], |
| 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 |
Patrick Williams | 47a0ada | 2023-11-29 06:45:00 -0600 | [diff] [blame] | 19 | assert(not get_option('tests').allowed(), 'Googletest is required') |
William A. Kennington III | 3f43b7e | 2021-02-16 16:54:40 -0800 | [diff] [blame] | 20 | endif |
| 21 | endif |
| 22 | |
| 23 | tests = [ |
| 24 | 'util_test', |
| 25 | ] |
| 26 | |
| 27 | foreach t : tests |
| 28 | test(t, executable(t.underscorify(), t + '.cpp', |
| 29 | implicit_include_directories: false, |
| 30 | dependencies: [gtest, gmock, dep])) |
| 31 | endforeach |
| 32 | |