1*1e76060aSYuxiao Zhang# Copyright 2024 Google LLC
2*1e76060aSYuxiao Zhang#
3*1e76060aSYuxiao Zhang# Licensed under the Apache License, Version 2.0 (the "License");
4*1e76060aSYuxiao Zhang# you may not use this file except in compliance with the License.
5*1e76060aSYuxiao Zhang# You may obtain a copy of the License at
6*1e76060aSYuxiao Zhang#
7*1e76060aSYuxiao Zhang#      http://www.apache.org/licenses/LICENSE-2.0
8*1e76060aSYuxiao Zhang#
9*1e76060aSYuxiao Zhang# Unless required by applicable law or agreed to in writing, software
10*1e76060aSYuxiao Zhang# distributed under the License is distributed on an "AS IS" BASIS,
11*1e76060aSYuxiao Zhang# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*1e76060aSYuxiao Zhang# See the License for the specific language governing permissions and
13*1e76060aSYuxiao Zhang# limitations under the License.
14*1e76060aSYuxiao Zhang#
15*1e76060aSYuxiao Zhanggtest = dependency('gtest', main: true, disabler: true, required: false)
16*1e76060aSYuxiao Zhangif not gtest.found()
17*1e76060aSYuxiao Zhang  gtest_proj = import('cmake').subproject(
18*1e76060aSYuxiao Zhang    'googletest',
19*1e76060aSYuxiao Zhang    cmake_options: [
20*1e76060aSYuxiao Zhang      '-DCMAKE_CXX_FLAGS=-Wno-pedantic',
21*1e76060aSYuxiao Zhang    ],
22*1e76060aSYuxiao Zhang    required: false)
23*1e76060aSYuxiao Zhang  if gtest_proj.found()
24*1e76060aSYuxiao Zhang    gtest = declare_dependency(
25*1e76060aSYuxiao Zhang      dependencies: [
26*1e76060aSYuxiao Zhang        dependency('threads'),
27*1e76060aSYuxiao Zhang        gtest_proj.dependency('gtest'),
28*1e76060aSYuxiao Zhang        gtest_proj.dependency('gtest_main'),
29*1e76060aSYuxiao Zhang      ])
30*1e76060aSYuxiao Zhang  else
31*1e76060aSYuxiao Zhang    assert(not build_tests.allowed(), 'Googletest is required')
32*1e76060aSYuxiao Zhang  endif
33*1e76060aSYuxiao Zhangendif
34*1e76060aSYuxiao Zhang
35*1e76060aSYuxiao Zhangtest('fileio_test', executable('fileio_test',
36*1e76060aSYuxiao Zhang  ['fileio_test.cpp'],
37*1e76060aSYuxiao Zhang  implicit_include_directories: false,
38*1e76060aSYuxiao Zhang  dependencies: [gtest, dependency('stdplus')],
39*1e76060aSYuxiao Zhang  link_with : fileio_lib))
40