Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@ endforeach()
set(ZEPHYR_CURRENT_MODULE_DIR)
set(ZEPHYR_CURRENT_CMAKE_DIR)

get_property(LIBC_LINK_LIBRARIES TARGET zephyr_interface PROPERTY LIBC_LINK_LIBRARIES)
zephyr_link_libraries(${LIBC_LINK_LIBRARIES})
Comment on lines +598 to +599
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in most cases this will work, but technically we are not guaranteed that there will not be added extra link libraries to the Zephyr interface library.

If the app adds extra libraries to explicitly be linked, then those might a appear later, or even some Zephyr libs could have extra libs.
However, as this still seems to ba an improvement, this comment is mostly in order for future references.

Will create followup enhancement issue.


set(syscall_list_h ${CMAKE_CURRENT_BINARY_DIR}/include/generated/syscall_list.h)
set(syscalls_json ${CMAKE_CURRENT_BINARY_DIR}/misc/generated/syscalls.json)
set(struct_tags_json ${CMAKE_CURRENT_BINARY_DIR}/misc/generated/struct_tags.json)
Expand Down
4 changes: 4 additions & 0 deletions cmake/modules/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ function(zephyr_link_libraries)
target_link_libraries(zephyr_interface INTERFACE ${ARGV})
endfunction()

function(zephyr_libc_link_libraries)
set_property(TARGET zephyr_interface APPEND PROPERTY LIBC_LINK_LIBRARIES ${ARGV})
endfunction()

# See this file section 3.1. target_cc_option
function(zephyr_cc_option)
foreach(arg ${ARGV})
Expand Down
2 changes: 1 addition & 1 deletion lib/libc/picolibc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if(NOT CONFIG_PICOLIBC_USE_MODULE)

zephyr_compile_options(--specs=picolibc.specs)
zephyr_compile_definitions(_POSIX_C_SOURCE=200809)
zephyr_link_libraries(-T/dev/null --specs=picolibc.specs c -lgcc)
zephyr_libc_link_libraries(-T/dev/null --specs=picolibc.specs c -lgcc)
if(CONFIG_PICOLIBC_IO_FLOAT)
zephyr_compile_definitions(PICOLIBC_DOUBLE_PRINTF_SCANF)
zephyr_link_libraries(-DPICOLIBC_DOUBLE_PRINTF_SCANF)
Expand Down