1*a8f5911bSWilliam A. Kennington IIIgtest = dependency('gtest', main: true, disabler: true, required: false) 2*a8f5911bSWilliam A. Kennington IIIgmock = dependency('gmock', disabler: true, required: false) 3*a8f5911bSWilliam A. Kennington IIIif not gtest.found() or not gmock.found() 4*a8f5911bSWilliam A. Kennington III gtest_opts = import('cmake').subproject_options() 5*a8f5911bSWilliam A. Kennington III gtest_opts.add_cmake_defines({'CMAKE_CXX_FLAGS': '-Wno-pedantic'}) 6*a8f5911bSWilliam A. Kennington III gtest_proj = import('cmake').subproject( 7*a8f5911bSWilliam A. Kennington III 'googletest', 8*a8f5911bSWilliam A. Kennington III options: gtest_opts, 9*a8f5911bSWilliam A. Kennington III required: false) 10*a8f5911bSWilliam A. Kennington III if gtest_proj.found() 11*a8f5911bSWilliam A. Kennington III gtest = declare_dependency( 12*a8f5911bSWilliam A. Kennington III dependencies: [ 13*a8f5911bSWilliam A. Kennington III dependency('threads'), 14*a8f5911bSWilliam A. Kennington III gtest_proj.dependency('gtest'), 15*a8f5911bSWilliam A. Kennington III gtest_proj.dependency('gtest_main'), 16*a8f5911bSWilliam A. Kennington III ]) 17*a8f5911bSWilliam A. Kennington III gmock = gtest_proj.dependency('gmock') 18*a8f5911bSWilliam A. Kennington III else 19*a8f5911bSWilliam A. Kennington III assert(not build_tests.enabled(), 'Googletest is required') 20*a8f5911bSWilliam A. Kennington III endif 21*a8f5911bSWilliam A. Kennington IIIendif 22*a8f5911bSWilliam A. Kennington III 23b9337710SWilliam A. Kennington III 24b9337710SWilliam A. Kennington IIItests = [ 25b9337710SWilliam A. Kennington III 'watchdog', 26b9337710SWilliam A. Kennington III] 27b9337710SWilliam A. Kennington III 28b9337710SWilliam A. Kennington IIIforeach t : tests 290b3c3899SWilliam A. Kennington III test( 300b3c3899SWilliam A. Kennington III t, 310b3c3899SWilliam A. Kennington III executable( 320b3c3899SWilliam A. Kennington III t.underscorify(), 330b3c3899SWilliam A. Kennington III t + '.cpp', 34b9337710SWilliam A. Kennington III implicit_include_directories: false, 35080ffd7aSWilliam A. Kennington III dependencies: [watchdog_dep, gtest, gmock])) 36b9337710SWilliam A. Kennington IIIendforeach 37