cmake: SHELL: vs zephyr_get_compile_X_for_lang

In zephyr_get_XYZ_for_lang() functions in extensions.cmake we try to mimic
what cmake does in generation time to filter out SHELL: tags. However,
this filtering was only done for list entries that did not contain
generator expressions.

This causes broken command lines for e.g. e.g. for the kobject_hash*c
if the toolchain puts "SHELL: $<$<COMPILER_LANGUAGE:C>:some thing>"
into the options.

Signed-off-by: Björn Bergman <bjorn.bergman@iar.com>
This commit is contained in:
Björn Bergman 2025-01-29 11:09:54 +01:00 committed by Benjamin Cabé
commit b0e08c8262

View file

@ -336,6 +336,12 @@ function(process_flags lang input output)
foreach(flag ${${input}})
set(is_compile_lang_generator_expression 0)
# SHELL is used to avoid de-duplication, but when process flags
# then this tag must be removed to return real compile/linker flags.
if(flag MATCHES "^SHELL:[ ]*(.*)")
separate_arguments(flag UNIX_COMMAND ${CMAKE_MATCH_1})
endif()
foreach(l ${languages})
if(flag MATCHES "<COMPILE_LANGUAGE:${l}>:([^>]+)>")
set(updated_flag ${CMAKE_MATCH_1})
@ -356,11 +362,6 @@ function(process_flags lang input output)
endforeach()
if(NOT is_compile_lang_generator_expression)
# SHELL is used to avoid de-duplication, but when process flags
# then this tag must be removed to return real compile/linker flags.
if(flag MATCHES "SHELL:[ ]*(.*)")
separate_arguments(flag UNIX_COMMAND ${CMAKE_MATCH_1})
endif()
# Flags may be placed inside generator expression, therefore any flag
# which is not already a generator expression must have commas converted.
if(NOT flag MATCHES "\\\$<.*>")