Cindy Liu | 14c5390 | 2021-08-03 21:34:00 +0000 | [diff] [blame] | 1 | # A cmake cache to connect springbok BSP with the executables |
| 2 | |
| 3 | if(NOT TARGET springbok) |
| 4 | message(FATAL_ERROR "Please include springbok target first") |
| 5 | endif() |
| 6 | |
| 7 | if(NOT DEFINED SPRINGBOK_LINKER_SCRIPT) |
| 8 | message(FATAL_ERROR "Please specifiy SPRINGBOK_LINKER_SCRIPT path first") |
| 9 | endif() |
| 10 | |
| 11 | function(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() |
| 21 | endfunction() |