include(CMakePrintHelpers) set(LIB_SOURCES sys/_exit.c sys/close.c sys/execve.c sys/fork.c sys/fstat.c sys/getpid.c sys/isatty.c sys/kill.c sys/link.c sys/lseek.c sys/open.c sys/openat.c sys/printf.c sys/puts.c sys/read.c sys/sbrk.c sys/stat.c sys/times.c sys/unlink.c sys/wait.c sys/write.c # Standard library stdlib/malloc.c # Miscellaneous misc/write_hex.c ) set(WRAP_ARGS "") foreach(FILE ${LIB_SOURCES}) get_filename_component(DIR ${FILE} DIRECTORY) if(DIR STREQUAL "sys") get_filename_component(BASE_NAME ${FILE} NAME_WE) list(APPEND WRAP_ARGS "LINKER:--wrap=${BASE_NAME}") endif() endforeach() add_library(wrap STATIC ${LIB_SOURCES} ../env/${BOARD_BASE}/bsp_write.c ../env/${BOARD_BASE}/bsp_read.c) target_link_options(wrap INTERFACE ${WRAP_ARGS})