From ad8b90ad362f620b8a58bcce6bb1d9014a65124a Mon Sep 17 00:00:00 2001 From: Luca Burelli Date: Wed, 10 Apr 2024 17:34:32 +0200 Subject: [PATCH] cmake: add_llext_target: handle empty LLEXT_REMOVE_FLAGS When LLEXT_REMOVE_FLAGS is empty, the regular expression that is constructed to remove flags from the Zephyr flags would match any string, resulting in all flags being removed. This is not the intended behavior, so we need to handle this case by setting the regular expression to a pattern that does not match anything. Signed-off-by: Luca Burelli --- cmake/modules/extensions.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 35fa6b3a0f8..35711a27b77 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -5302,6 +5302,11 @@ function(add_llext_target target_name) OUTPUT_VARIABLE llext_remove_flags_regexp ) string(REPLACE ";" "|" llext_remove_flags_regexp "${llext_remove_flags_regexp}") + if ("${llext_remove_flags_regexp}" STREQUAL "") + # an empty regexp would match anything, we actually need the opposite + # so set it to match empty strings + set(llext_remove_flags_regexp "^$") + endif() set(zephyr_flags "$" )