blob: be18ef6b97727d7e2130bdea29763ce6b28c1842 [file] [log] [blame]
# A cmake cache to connect kelvin BSP with the executables
if((NOT TARGET kelvin))
message(FATAL_ERROR "Please include kelvin target first")
endif()
if(NOT DEFINED KELVIN_LINKER_SCRIPT)
message(FATAL_ERROR "Please specifiy KELVIN_LINKER_SCRIPT path first")
endif()
function(add_executable executable)
cmake_parse_arguments(AE "ALIAS;IMPORTED" "" "" ${ARGN})
if(AE_ALIAS OR AE_IMPORTED)
_add_executable(${executable} ${ARGN})
else()
_add_executable(${executable} ${ARGN})
target_link_libraries(${executable} PRIVATE kelvin)
target_link_options(${executable} PRIVATE "-T${KELVIN_LINKER_SCRIPT}")
target_link_options(${executable} PRIVATE "-nostartfiles")
endif()
endfunction()