blob: 11eef4d35ce1473d51455b4d8bb0d995ff677dce [file] [log] [blame]
Cindy Liu14c53902021-08-03 21:34:00 +00001# A cmake cache to connect springbok BSP with the executables
2
3if(NOT TARGET springbok)
4 message(FATAL_ERROR "Please include springbok target first")
5endif()
6
7if(NOT DEFINED SPRINGBOK_LINKER_SCRIPT)
8 message(FATAL_ERROR "Please specifiy SPRINGBOK_LINKER_SCRIPT path first")
9endif()
10
11function(add_executable executable)
12 cmake_parse_arguments(AE "ALIAS;IMPORTED" "" "" ${ARGN})
13 if(AE_ALIAS OR AE_IMPORTED)
14 _add_executable(${executable} ${ARGN})
15 else()
16 _add_executable(${executable} ${ARGN})
17 target_link_libraries(${executable} PRIVATE springbok)
18 target_link_options(${executable} PRIVATE "-T${SPRINGBOK_LINKER_SCRIPT}")
19 target_link_options(${executable} PRIVATE "-nostartfiles")
20 endif()
21endfunction()