cmake: make TARGET optional in set_linker_property()

The `check_set_linker_property()` and `set_linker_property()` takes a
target argument. Make the target argument optional and use the target
`linker` as default target.

The function name `set_linker_property()` already implies that we are
setting a property and the linker target.

Remove the need to specify `TARGET linker` when using the default linker
property target.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2024-09-11 10:18:13 +02:00 committed by Fabio Baltieri
commit 102b3fc078

View file

@ -2440,7 +2440,7 @@ endfunction()
# defined with a value.
# APPEND: Flag indicated that the property should be appended to the existing
# value list for the property.
# TARGET: Name of target on which to add the property (commonly: linker)
# TARGET: Name of target on which to add the property (default: linker)
# PROPERTY: Name of property with the value(s) following immediately after
# property name
function(set_linker_property)
@ -2453,6 +2453,10 @@ function(set_linker_property)
set(APPEND "APPEND")
endif()
if(NOT DEFINED LINKER_PROPERTY_TARGET)
set(LINKER_PROPERTY_TARGET "linker")
endif()
if(LINKER_PROPERTY_NO_CREATE)
list(GET LINKER_PROPERTY_PROPERTY 0 property_name)
get_target_property(var ${LINKER_PROPERTY_TARGET} ${property_name})
@ -2472,7 +2476,7 @@ endfunction()
#
# APPEND: Flag indicated that the property should be appended to the existing
# value list for the property.
# TARGET: Name of target on which to add the property (commonly: linker)
# TARGET: Name of target on which to add the property (default: linker)
# PROPERTY: Name of property with the value(s) following immediately after
# property name
function(check_set_linker_property)
@ -2485,6 +2489,10 @@ function(check_set_linker_property)
set(APPEND "APPEND")
endif()
if(NOT DEFINED LINKER_PROPERTY_TARGET)
set(LINKER_PROPERTY_TARGET "linker")
endif()
list(GET LINKER_PROPERTY_PROPERTY 0 property)
list(REMOVE_AT LINKER_PROPERTY_PROPERTY 0)