xref: /openbmc/google-misc/subprojects/dhcp-done/test/meson.build (revision 24c61c7ee8583830fd0916b7b2c7bf0561569e0f)
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: ['-DCMAKE_CXX_FLAGS=-Wno-pedantic'],
20        required: false,
21    )
22    if gtest_proj.found()
23        gtest = declare_dependency(
24            dependencies: [
25                dependency('threads'),
26                gtest_proj.dependency('gtest'),
27                gtest_proj.dependency('gtest_main'),
28            ],
29        )
30    else
31        assert(not build_tests.allowed(), 'Googletest is required')
32    endif
33endif
34
35test(
36    'fileio_test',
37    executable(
38        'fileio_test',
39        ['fileio_test.cpp'],
40        implicit_include_directories: false,
41        dependencies: [gtest, dependency('stdplus')],
42        link_with: fileio_lib,
43    ),
44)
45