Skip to content

Commit 102b3fc

Browse files
tejlmandfabiobaltieri
authored andcommitted
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]>
1 parent 718b726 commit 102b3fc

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
@@ -2440,7 +2440,7 @@ endfunction()
24402440
# defined with a value.
24412441
# APPEND: Flag indicated that the property should be appended to the existing
24422442
# value list for the property.
2443-
# TARGET: Name of target on which to add the property (commonly: linker)
2443+
# TARGET: Name of target on which to add the property (default: linker)
24442444
# PROPERTY: Name of property with the value(s) following immediately after
24452445
# property name
24462446
function(set_linker_property)
@@ -2453,6 +2453,10 @@ function(set_linker_property)
24532453
set(APPEND "APPEND")
24542454
endif()
24552455

2456+
if(NOT DEFINED LINKER_PROPERTY_TARGET)
2457+
set(LINKER_PROPERTY_TARGET "linker")
2458+
endif()
2459+
24562460
if(LINKER_PROPERTY_NO_CREATE)
24572461
list(GET LINKER_PROPERTY_PROPERTY 0 property_name)
24582462
get_target_property(var ${LINKER_PROPERTY_TARGET} ${property_name})
@@ -2472,7 +2476,7 @@ endfunction()
24722476
#
24732477
# APPEND: Flag indicated that the property should be appended to the existing
24742478
# value list for the property.
2475-
# TARGET: Name of target on which to add the property (commonly: linker)
2479+
# TARGET: Name of target on which to add the property (default: linker)
24762480
# PROPERTY: Name of property with the value(s) following immediately after
24772481
# property name
24782482
function(check_set_linker_property)
@@ -2485,6 +2489,10 @@ function(check_set_linker_property)
24852489
set(APPEND "APPEND")
24862490
endif()
24872491

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

0 commit comments

Comments
 (0)