cmake: support PROPERTY argument on zephyr_link_libraries.
To ease the use of linker flag properties and to simplify the use of generator expression then an optional PROPERTY argument has been added to the zephyr_link_libraries() function. This means a call such as: zephyr_link_libraries($<TARGET_PROPERTY:linker,<property-name>) can instead be simplified to: zephyr_link_libraries(PROPERTY <property-name>) Thus making intention clearer and keeping the complexity and minimizes the risk of typos when writing generator expressions. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
1728e04b8c
commit
d63489195f
1 changed files with 8 additions and 1 deletions
|
@ -113,7 +113,14 @@ endfunction()
|
|||
|
||||
# https://cmake.org/cmake/help/latest/command/target_link_libraries.html
|
||||
function(zephyr_link_libraries)
|
||||
target_link_libraries(zephyr_interface INTERFACE ${ARGV})
|
||||
if(ARGV0 STREQUAL "PROPERTY")
|
||||
if(ARGC GREATER 2)
|
||||
message(FATAL_ERROR "zephyr_link_libraries(PROPERTY <prop>) only allows a single property.")
|
||||
endif()
|
||||
target_link_libraries(zephyr_interface INTERFACE $<TARGET_PROPERTY:linker,${ARGV1}>)
|
||||
else()
|
||||
target_link_libraries(zephyr_interface INTERFACE ${ARGV})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(zephyr_libc_link_libraries)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue