Skip to content

Commit 72b9bb5

Browse files
tejlmandjukkar
authored andcommitted
[nrf fromtree] 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 <[email protected]> (cherry picked from commit 102b3fc) (cherry picked from commit 185ea88)
1 parent c0f4060 commit 72b9bb5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

cmake/modules/extensions.cmake

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2441,7 +2441,7 @@ endfunction()
24412441
# defined with a value.
24422442
# APPEND: Flag indicated that the property should be appended to the existing
24432443
# value list for the property.
2444-
# TARGET: Name of target on which to add the property (commonly: linker)
2444+
# TARGET: Name of target on which to add the property (default: linker)
24452445
# PROPERTY: Name of property with the value(s) following immediately after
24462446
# property name
24472447
function(set_linker_property)
@@ -2454,6 +2454,10 @@ function(set_linker_property)
24542454
set(APPEND "APPEND")
24552455
endif()
24562456

2457+
if(NOT DEFINED LINKER_PROPERTY_TARGET)
2458+
set(LINKER_PROPERTY_TARGET "linker")
2459+
endif()
2460+
24572461
if(LINKER_PROPERTY_NO_CREATE)
24582462
list(GET LINKER_PROPERTY_PROPERTY 0 property_name)
24592463
get_target_property(var ${LINKER_PROPERTY_TARGET} ${property_name})
@@ -2473,7 +2477,7 @@ endfunction()
24732477
#
24742478
# APPEND: Flag indicated that the property should be appended to the existing
24752479
# value list for the property.
2476-
# TARGET: Name of target on which to add the property (commonly: linker)
2480+
# TARGET: Name of target on which to add the property (default: linker)
24772481
# PROPERTY: Name of property with the value(s) following immediately after
24782482
# property name
24792483
function(check_set_linker_property)
@@ -2486,6 +2490,10 @@ function(check_set_linker_property)
24862490
set(APPEND "APPEND")
24872491
endif()
24882492

2493+
if(NOT DEFINED LINKER_PROPERTY_TARGET)
2494+
set(LINKER_PROPERTY_TARGET "linker")
2495+
endif()
2496+
24892497
list(GET LINKER_PROPERTY_PROPERTY 0 property)
24902498
list(REMOVE_AT LINKER_PROPERTY_PROPERTY 0)
24912499

0 commit comments

Comments
 (0)