1gtest = 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_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 19 assert(not build_tests.enabled(), 'Googletest is required') 20 endif 21endif 22 23 24tests = [ 25 'chip', 26 'event', 27 'handle', 28 'internal/fd', 29 'mocks', 30 'utility/aspeed', 31] 32 33foreach t : tests 34 test(t, executable(t.underscorify(), t + '.cpp', 35 implicit_include_directories: false, 36 dependencies: [gpioplus, gtest, gmock])) 37endforeach 38