From b0e08c826264aeef098e39a38bb15294bccd8c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Bergman?= Date: Wed, 29 Jan 2025 11:09:54 +0100 Subject: [PATCH] cmake: SHELL: vs zephyr_get_compile_X_for_lang MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: $<$:some thing>" into the options. Signed-off-by: Björn Bergman --- cmake/modules/extensions.cmake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 8350b2f3974..6df0ef51f67 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -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 ":([^>]+)>") 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 "\\\$<.*>")