TARGET_FILE generator expression on linked library
Hi I am trying to add linker options, including the targets output name. The logical solution would be using TARGET_FILE like this:
target_link_libraries(exetarget PRIVATE
-Wl,-Map=$<TARGET_FILE:$<TARGET_PROPERTY:NAME>>.map,--cref )
The result is a failure:
$<TARGET_FILE:$<TARGET_PROPERTY:NAME>>
Expressions which require the linker language may not be used while
evaluating link libraries
I am using this as workaround currently, but there are many issues like setting debug-suffix or OUTPUT_NAME that aren't handled in any way.
target_link_libraries(aboard_runner PRIVATE
-Wl,-Map=$<TARGET_PROPERTY:BINARY_DIR>/$<TARGET_PROPERTY:NAME>.map,--cref )
So my question/feature request would be:
- Is there a way to set linker flags with a generator expression using the targets final filename (ideally with its extension stripped)
- Most linker properties seem to not support generator expressions,
target_link_libraries
is a bad fit for flags. I would prefer a own function or property supporting generator expressions.