11285115cSWilliam A. Kennington IIIgtest = dependency('gtest', main: true, disabler: true, required: false)
21285115cSWilliam A. Kennington IIIgmock = dependency('gmock', disabler: true, required: false)
31285115cSWilliam A. Kennington IIIif not gtest.found() or not gmock.found()
41285115cSWilliam A. Kennington III  gtest_proj = import('cmake').subproject(
51285115cSWilliam A. Kennington III    'googletest',
61285115cSWilliam A. Kennington III    cmake_options: [
71285115cSWilliam A. Kennington III      '-DCMAKE_CXX_FLAGS=-Wno-pedantic',
81285115cSWilliam A. Kennington III    ],
91285115cSWilliam A. Kennington III    required: false)
101285115cSWilliam A. Kennington III  if gtest_proj.found()
111285115cSWilliam A. Kennington III    gtest = declare_dependency(
121285115cSWilliam A. Kennington III      dependencies: [
131285115cSWilliam A. Kennington III        dependency('threads'),
141285115cSWilliam A. Kennington III        gtest_proj.dependency('gtest'),
151285115cSWilliam A. Kennington III        gtest_proj.dependency('gtest_main'),
161285115cSWilliam A. Kennington III      ])
171285115cSWilliam A. Kennington III    gmock = gtest_proj.dependency('gmock')
181285115cSWilliam A. Kennington III  else
19*47a0ada2SPatrick Williams    assert(not get_option('tests').allowed(), 'Googletest is required')
201285115cSWilliam A. Kennington III  endif
211285115cSWilliam A. Kennington IIIendif
221285115cSWilliam A. Kennington III
231285115cSWilliam A. Kennington IIItests = [
241285115cSWilliam A. Kennington III  'util_test',
251285115cSWilliam A. Kennington III]
261285115cSWilliam A. Kennington III
271285115cSWilliam A. Kennington IIIforeach t : tests
281285115cSWilliam A. Kennington III  test(t, executable(t.underscorify(), t + '.cpp',
291285115cSWilliam A. Kennington III                     implicit_include_directories: false,
301285115cSWilliam A. Kennington III                     dependencies: [gtest, gmock, dep]))
311285115cSWilliam A. Kennington IIIendforeach
321285115cSWilliam A. Kennington III
33