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