blob: 59190170eca9d123a7f074891a5892065e5a7fd0 [file] [log] [blame]
Lun Dong26c106a2023-10-24 09:14:25 -07001# 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 Liu151e5c22021-11-12 18:59:32 -080015# A native log support to be compatible with springbok simprint
16#
17# Connect the logging library with the executables
18
19if(NOT TARGET native_log)
20 message(FATAL_ERROR "Please include native_log target first")
21endif()
22
23function(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()
31endfunction()