From 0201683adb512c5a36b530ae919ac092e4a0138f Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 10 Feb 2025 09:39:12 +0000 Subject: [PATCH] cmake: snippets: Add snippet help message Adds a help message which gives details on a common issue with snippets where the roots are not known or a snippet is applied to multiple images Signed-off-by: Jamie McCrae --- cmake/modules/snippets.cmake | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cmake/modules/snippets.cmake b/cmake/modules/snippets.cmake index fba7818c650..b897067667e 100644 --- a/cmake/modules/snippets.cmake +++ b/cmake/modules/snippets.cmake @@ -94,7 +94,20 @@ function(zephyr_process_snippets) ERROR_VARIABLE output RESULT_VARIABLE ret) if(${ret}) - message(FATAL_ERROR "${output}") + list(JOIN SNIPPET_ROOT "\n " snippet_root_paths) + set(snippet_root_paths "\n ${snippet_root_paths}") + + if(SYSBUILD) + zephyr_get(SYSBUILD_NAME SYSBUILD GLOBAL) + set(extra_output "Snippet roots for image ${SYSBUILD_NAME}:${snippet_root_paths}\n" + "Note that snippets will be applied to all images unless prefixed with the image name " + "e.g. `-D${SYSBUILD_NAME}_SNIPPET=...`, local snippet roots for one image are not set " + "for other images in a build") + else() + set(extra_output "Snippet roots for application:${snippet_root_paths}") + endif() + + message(FATAL_ERROR "${output}" ${extra_output}) endif() include(${snippets_generated})