From d63489195f0b14cb1a5c2f84eef6580eed3fec7f Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Mon, 2 Sep 2024 10:18:55 +0200 Subject: [PATCH] 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($) can instead be simplified to: zephyr_link_libraries(PROPERTY ) Thus making intention clearer and keeping the complexity and minimizes the risk of typos when writing generator expressions. Signed-off-by: Torsten Rasmussen --- cmake/modules/extensions.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 2e3dc14e3b2..158c46f7cdc 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -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 ) only allows a single property.") + endif() + target_link_libraries(zephyr_interface INTERFACE $) + else() + target_link_libraries(zephyr_interface INTERFACE ${ARGV}) + endif() endfunction() function(zephyr_libc_link_libraries)