diff --git a/cmake/modules/configuration_files.cmake b/cmake/modules/configuration_files.cmake index 24d5e9feed..06ad074f0c 100644 --- a/cmake/modules/configuration_files.cmake +++ b/cmake/modules/configuration_files.cmake @@ -116,5 +116,5 @@ DTC_OVERLAY_FILE=\"dts1.overlay dts2.overlay\"") # The DTC_OVERLAY_FILE variable is now set to its final value. zephyr_boilerplate_watch(DTC_OVERLAY_FILE) -zephyr_get(EXTRA_CONF_FILE SYSBUILD LOCAL VAR EXTRA_CONF_FILE OVERLAY_CONFIG) -zephyr_get(EXTRA_DTC_OVERLAY_FILE SYSBUILD LOCAL) +zephyr_get(EXTRA_CONF_FILE SYSBUILD LOCAL VAR EXTRA_CONF_FILE OVERLAY_CONFIG MERGE REVERSE) +zephyr_get(EXTRA_DTC_OVERLAY_FILE SYSBUILD LOCAL MERGE REVERSE) diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index bcba1fedf1..fe5fd26d09 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -2568,9 +2568,13 @@ function(zephyr_get variable) else() set(sysbuild_${var}) endif() + + if(TARGET snippets_scope) + get_property(snippets_${var} TARGET snippets_scope PROPERTY ${var}) + endif() endforeach() - set(scopes "sysbuild;CACHE;ENV;current") + set(scopes "sysbuild;CACHE;snippets;ENV;current") if(GET_VAR_REVERSE) list(REVERSE scopes) endif() diff --git a/cmake/modules/snippets.cmake b/cmake/modules/snippets.cmake index c3929c86b4..550d236a2f 100644 --- a/cmake/modules/snippets.cmake +++ b/cmake/modules/snippets.cmake @@ -93,10 +93,6 @@ function(zephyr_process_snippets) endif() include(${snippets_generated}) - # Propagate include()d build system settings to the caller. - set(DTC_OVERLAY_FILE ${DTC_OVERLAY_FILE} PARENT_SCOPE) - set(OVERLAY_CONFIG ${OVERLAY_CONFIG} PARENT_SCOPE) - # Create the 'snippets' target. Each snippet is printed in a # separate command because build system files are not fond of # newlines. diff --git a/scripts/snippets.py b/scripts/snippets.py index 74e7ebbbfc..a79f12584e 100644 --- a/scripts/snippets.py +++ b/scripts/snippets.py @@ -133,6 +133,9 @@ set(SNIPPET_NAMES {' '.join(f'"{name}"' for name in snippet_names)}) # The paths to all the snippet.yml files. One snippet # can have multiple snippet.yml files. set(SNIPPET_PATHS {snippet_path_list}) + +# Create variable scope for snippets build variables +zephyr_create_scope(snippets) ''') for snippet_name in snippet_names: @@ -168,7 +171,7 @@ if("${{BOARD}}" STREQUAL "{board}")''') space = ' ' * indent for name, values in appends.items(): for value in values: - self.print(f'{space}list(APPEND {name} {value})') + self.print(f'{space}zephyr_set({name} {value} SCOPE snippets APPEND)') def print(self, *args, **kwargs): kwargs['file'] = self.out_file