From 3b32444f10c59b42a3fa4ed84d5ccdaf223a3809 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 8 Dec 2022 11:06:32 +0100 Subject: [PATCH] sysbuild: shared cache variable instead of local scope variable Fixes: #52353 If a CMake variable is available in both local scope and as CMake cache variable, then the use of `${}` fetches the local scoped variable. If only the cache variable is set, then things works as expected. Ensure that the cached variable is always the variable being shared to images by using `$CACHE{}` instead. Signed-off-by: Torsten Rasmussen --- share/sysbuild/cmake/modules/sysbuild_extensions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake index ee7a4436772..d79bcff5bf6 100644 --- a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake @@ -183,7 +183,7 @@ function(ExternalZephyrProject_Add) # Required CMake variable to be passed, like CMAKE_BUILD_TYPE must be # passed using `-D` on command invocation. get_property(var_type CACHE ${var_name} PROPERTY TYPE) - set(cache_entry "${var_name}:${var_type}=${${var_name}}") + set(cache_entry "${var_name}:${var_type}=$CACHE{${var_name}}") string(REPLACE ";" "\;" cache_entry "${cache_entry}") list(APPEND sysbuild_cache_strings "${cache_entry}\n") endif()