Commit d6348919 authored by Torsten Rasmussen's avatar Torsten Rasmussen Committed by Carles Cufi
Browse files

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: default avatarTorsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
parent 1728e04b
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -113,7 +113,14 @@ endfunction()

# https://cmake.org/cmake/help/latest/command/target_link_libraries.html
function(zephyr_link_libraries)
  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)