1# Copyright 2020 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 15if(SAPI_BUILD_EXAMPLES) 16 # Build the unsandboxed main 17 add_executable(lodepng_unsandboxed 18 main_unsandboxed.cc 19 helpers.cc 20 ) 21 target_link_libraries(lodepng_unsandboxed PRIVATE 22 absl::check 23 absl::flags_parse 24 absl::log_globals 25 absl::log_initialize 26 lodepng 27 sapi::sapi 28 sapi::temp_file 29 sapi::file_base 30 sapi::fileops 31 ) 32 33 # Build the sandboxed main 34 add_executable(lodepng_sandboxed 35 main_sandboxed.cc 36 sandbox.h 37 helpers.cc 38 ) 39 target_link_libraries(lodepng_sandboxed PRIVATE 40 absl::check 41 absl::flags_parse 42 absl::log_globals 43 absl::log_initialize 44 sapi_contrib::lodepng 45 sapi::sapi 46 sapi::temp_file 47 sapi::fileops 48 sapi::vars 49 sapi::status 50 ) 51endif() 52 53if(BUILD_TESTING AND SAPI_BUILD_TESTING) 54 add_executable(main_unit_test 55 main_unit_test.cc 56 helpers.cc 57 ) 58 target_link_libraries(main_unit_test PRIVATE 59 sapi_contrib::lodepng 60 absl::check 61 absl::strings 62 absl::time 63 sapi::sapi 64 sapi::temp_file 65 sapi::fileops 66 sapi::status 67 sapi::test_main 68 sapi::vars 69 ) 70 gtest_discover_tests(main_unit_test) 71endif() 72