11e76060aSYuxiao Zhang# Copyright 2024 Google LLC 21e76060aSYuxiao Zhang# 31e76060aSYuxiao Zhang# Licensed under the Apache License, Version 2.0 (the "License"); 41e76060aSYuxiao Zhang# you may not use this file except in compliance with the License. 51e76060aSYuxiao Zhang# You may obtain a copy of the License at 61e76060aSYuxiao Zhang# 71e76060aSYuxiao Zhang# http://www.apache.org/licenses/LICENSE-2.0 81e76060aSYuxiao Zhang# 91e76060aSYuxiao Zhang# Unless required by applicable law or agreed to in writing, software 101e76060aSYuxiao Zhang# distributed under the License is distributed on an "AS IS" BASIS, 111e76060aSYuxiao Zhang# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 121e76060aSYuxiao Zhang# See the License for the specific language governing permissions and 131e76060aSYuxiao Zhang# limitations under the License. 141e76060aSYuxiao Zhang# 151e76060aSYuxiao Zhanggtest = dependency('gtest', main: true, disabler: true, required: false) 161e76060aSYuxiao Zhangif not gtest.found() 171e76060aSYuxiao Zhang gtest_proj = import('cmake').subproject( 181e76060aSYuxiao Zhang 'googletest', 19*24c61c7eSPatrick Williams cmake_options: ['-DCMAKE_CXX_FLAGS=-Wno-pedantic'], 20*24c61c7eSPatrick Williams required: false, 21*24c61c7eSPatrick Williams ) 221e76060aSYuxiao Zhang if gtest_proj.found() 231e76060aSYuxiao Zhang gtest = declare_dependency( 241e76060aSYuxiao Zhang dependencies: [ 251e76060aSYuxiao Zhang dependency('threads'), 261e76060aSYuxiao Zhang gtest_proj.dependency('gtest'), 271e76060aSYuxiao Zhang gtest_proj.dependency('gtest_main'), 28*24c61c7eSPatrick Williams ], 29*24c61c7eSPatrick Williams ) 301e76060aSYuxiao Zhang else 311e76060aSYuxiao Zhang assert(not build_tests.allowed(), 'Googletest is required') 321e76060aSYuxiao Zhang endif 331e76060aSYuxiao Zhangendif 341e76060aSYuxiao Zhang 35*24c61c7eSPatrick Williamstest( 36*24c61c7eSPatrick Williams 'fileio_test', 37*24c61c7eSPatrick Williams executable( 38*24c61c7eSPatrick Williams 'fileio_test', 391e76060aSYuxiao Zhang ['fileio_test.cpp'], 401e76060aSYuxiao Zhang implicit_include_directories: false, 411e76060aSYuxiao Zhang dependencies: [gtest, dependency('stdplus')], 42*24c61c7eSPatrick Williams link_with: fileio_lib, 43*24c61c7eSPatrick Williams ), 44*24c61c7eSPatrick Williams) 45