From 782a0515ed2d09723d8d41938ff142c860f0a253 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Thu, 13 Apr 2023 12:20:01 +0200 Subject: [PATCH] sysbuild: ensure warning is only printed when VAR is not used When calling `sysbuild_get( VAR ...)` user specifically specify the output variable and in such cases the overwrite warning should not be printed, because such invocation is similar to a regular `set( )` CMake call. Only the invocation where the same variable name is used for lookup and return variable, then the warning must be printed to avoid unintentional overwriting of existing variables. 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 70c7aad3e58..5960c63c31e 100644 --- a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake @@ -75,7 +75,7 @@ function(sysbuild_get variable) message(FATAL_ERROR "sysbuild_get(...) requires IMAGE.") endif() - if(DEFINED ${variable}) + if(DEFINED ${variable} AND NOT DEFINED GET_VAR_VAR) message(WARNING "Return variable ${variable} already defined with a value. " "sysbuild_get(${variable} ...) may overwrite existing value. " "Please use sysbuild_get( ... VAR ) "