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 "\\\$<.*>")