Lun Dong | 26c106a | 2023-10-24 09:14:25 -0700 | [diff] [blame] | 1 | # Copyright 2023 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 | |
Cindy Liu | 151e5c2 | 2021-11-12 18:59:32 -0800 | [diff] [blame] | 15 | # A native log support to be compatible with springbok simprint |
| 16 | # |
| 17 | # Connect the logging library with the executables |
| 18 | |
| 19 | if(NOT TARGET native_log) |
| 20 | message(FATAL_ERROR "Please include native_log target first") |
| 21 | endif() |
| 22 | |
| 23 | function(add_executable executable) |
| 24 | cmake_parse_arguments(AE "ALIAS;IMPORTED" "" "" ${ARGN}) |
| 25 | if(AE_ALIAS OR AE_IMPORTED) |
| 26 | _add_executable(${executable} ${ARGN}) |
| 27 | else() |
| 28 | _add_executable(${executable} ${ARGN}) |
| 29 | target_link_libraries(${executable} PRIVATE native_log) |
| 30 | endif() |
| 31 | endfunction() |