|
| 1 | +# ~~~ |
| 2 | +# Copyright 2020 Google LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +# ~~~ |
| 16 | + |
| 17 | +if (BUILD_TESTING) |
| 18 | + find_package(GTest CONFIG REQUIRED) |
| 19 | + set(googleapis_functions_framework_examples_unit_tests |
| 20 | + # cmake-format: sort |
| 21 | + http_integration_test.cc http_unit_test.cc) |
| 22 | + |
| 23 | + set(googleapis_functions_framework_examples_programs |
| 24 | + # cmake-format: sort |
| 25 | + http_integration_server.cc) |
| 26 | + |
| 27 | + foreach (fname ${googleapis_functions_framework_examples_unit_tests} |
| 28 | + ${googleapis_functions_framework_examples_programs}) |
| 29 | + string(REPLACE "/" "_" target "${fname}") |
| 30 | + string(REPLACE ".cc" "" target "${target}") |
| 31 | + add_executable("${target}" ${fname}) |
| 32 | + target_link_libraries( |
| 33 | + ${target} |
| 34 | + PRIVATE functions_framework_examples googleapis_functions_framework |
| 35 | + Boost::filesystem GTest::gmock_main GTest::gmock |
| 36 | + GTest::gtest) |
| 37 | + endforeach () |
| 38 | + |
| 39 | + foreach (fname ${googleapis_functions_framework_examples_unit_tests}) |
| 40 | + string(REPLACE "/" "_" target "${fname}") |
| 41 | + string(REPLACE ".cc" "" target "${target}") |
| 42 | + add_test(NAME ${target} COMMAND ${target}) |
| 43 | + endforeach () |
| 44 | +endif () |
0 commit comments