gtest_dep = dependency('gtest', main: true, disabler: true, required: false) gmock_dep = dependency('gmock', disabler: true, required: false) if not gtest_dep.found() or not gmock_dep.found() gtest_proj = import('cmake').subproject('googletest', required: false) if gtest_proj.found() gtest_dep = declare_dependency( dependencies: [ dependency('threads'), gtest_proj.dependency('gtest'), gtest_proj.dependency('gtest_main'), ], ) gmock_dep = gtest_proj.dependency('gmock') else assert( not get_option('tests').allowed(), 'Googletest is required if tests are enabled', ) endif endif ut_deps_list = [ gtest_dep, ] ut_deps_list += default_deps test( 'test_utils', executable( 'test_utils', 'test_Utils.cpp', '../src/Utils.cpp', dependencies: ut_deps_list, implicit_include_directories: false, include_directories: '../src', ), )