Skip to content

Commit 0201683

Browse files
nordicjmkartben
authored andcommitted
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 <[email protected]>
1 parent ef232f3 commit 0201683

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cmake/modules/snippets.cmake

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,20 @@ function(zephyr_process_snippets)
9494
ERROR_VARIABLE output
9595
RESULT_VARIABLE ret)
9696
if(${ret})
97-
message(FATAL_ERROR "${output}")
97+
list(JOIN SNIPPET_ROOT "\n " snippet_root_paths)
98+
set(snippet_root_paths "\n ${snippet_root_paths}")
99+
100+
if(SYSBUILD)
101+
zephyr_get(SYSBUILD_NAME SYSBUILD GLOBAL)
102+
set(extra_output "Snippet roots for image ${SYSBUILD_NAME}:${snippet_root_paths}\n"
103+
"Note that snippets will be applied to all images unless prefixed with the image name "
104+
"e.g. `-D${SYSBUILD_NAME}_SNIPPET=...`, local snippet roots for one image are not set "
105+
"for other images in a build")
106+
else()
107+
set(extra_output "Snippet roots for application:${snippet_root_paths}")
108+
endif()
109+
110+
message(FATAL_ERROR "${output}" ${extra_output})
98111
endif()
99112
include(${snippets_generated})
100113

0 commit comments

Comments
 (0)