1# Copyright 2019 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# https://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# sandboxed_api/tools/filewrapper:filewrapper 16add_executable(filewrapper 17 filewrapper.cc 18) 19target_link_libraries(filewrapper PRIVATE 20 absl::strings 21 absl::str_format 22 sapi::fileops 23 sapi::strerror 24 sapi::base 25 sapi::raw_logging 26) 27 28sapi_cc_embed_data(NAME filewrapper_embedded 29 NAMESPACE "" 30 SOURCES testdata/filewrapper_embedded.bin 31) 32 33if(BUILD_TESTING AND SAPI_BUILD_TESTING) 34 # sandboxed_api/tools/filewrapper:filewrapper_test 35 add_executable(sapi_filewrapper_test 36 filewrapper_test.cc 37 ) 38 set_target_properties(sapi_filewrapper_test PROPERTIES 39 OUTPUT_NAME filewrapper_test 40 ) 41 configure_file(testdata/filewrapper_embedded.bin 42 testdata/filewrapper_embedded.bin COPYONLY) 43 target_link_libraries(sapi_filewrapper_test PRIVATE 44 filewrapper_embedded 45 sapi::file_helpers 46 sapi::fileops 47 sapi::testing 48 sapi::status_matchers 49 sapi::test_main 50 ) 51 gtest_discover_tests_xcompile(sapi_filewrapper_test PROPERTIES 52 ENVIRONMENT "TEST_TMPDIR=/tmp" 53 ENVIRONMENT "TEST_SRCDIR=${PROJECT_BINARY_DIR}" 54 ) 55endif() 56