check_cxx_compiler_flag / check_cxx_source_compiles should support setting the new LINK_OPTIONS property
The new link options finally support generators and are generally convenient, but there is infrastructure missing to test link options, take this working option:
target_link_options(aboard_runner PRIVATE
LINKER:-Map=$<TARGET_FILE:$<TARGET_PROPERTY:NAME>>.map
)
Testing the Option String as its used is not possible.
# Wont work
set(CMAKE_REQUIRED_LIBRARIES "LINKER:-Map=$<TARGET_FILE:$<TARGET_PROPERTY:NAME>>.map")
check_cxx_compiler_flag("-Werror" CXX_COMPILER_HASMAPOUTPUT)
# Wont work (Expressions which require the linker language may not be used while evaluating link libraries)
set(CMAKE_REQUIRED_LIBRARIES "-Wl,-Map=$<TARGET_FILE:$<TARGET_PROPERTY:NAME>>.map")
check_cxx_compiler_flag("-Werror" CXX_COMPILER_HASMAPOUTPUT)
# Works:
set(CMAKE_REQUIRED_LIBRARIES "-Wl,-Map=$<TARGET_PROPERTY:BINARY_DIR>/$<TARGET_PROPERTY:NAME>.map")
check_cxx_compiler_flag("-Werror" CXX_COMPILER_HASMAPOUTPUT)
So I would ask for a a new variable CMAKE_REQUIRED_LINK_OPTIONS to be supported by the check_*_compiler_flag scripts, to be able to directly tests option strings