Yuxiao Zhang | 1e76060 | 2024-03-07 12:35:24 -0800 | [diff] [blame] | 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 | # |
| 15 | gtest = dependency('gtest', main: true, disabler: true, required: false) |
| 16 | if not gtest.found() |
Patrick Williams | 24c61c7 | 2025-02-01 08:38:07 -0500 | [diff] [blame] | 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 |
Yuxiao Zhang | 1e76060 | 2024-03-07 12:35:24 -0800 | [diff] [blame] | 33 | endif |
| 34 | |
Patrick Williams | 24c61c7 | 2025-02-01 08:38:07 -0500 | [diff] [blame] | 35 | test( |
| 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 | ) |