doc: build: snippets: application required snippets

Document how an application can automatically include snippets when
being built.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
Jordan Yates 2024-01-27 12:22:42 +10:00 committed by Carles Cufí
parent ef8e32561d
commit d323acafc3
1 changed files with 14 additions and 0 deletions

View File

@ -37,3 +37,17 @@ snippet names you want to use. For example:
cmake -Sapp -Bbuild -DSNIPPET="snippet1;snippet2" [...]
cmake --build build
Application required snippets
*****************************
If an application should always be compiled with a given snippet, it
can be added to that application's ``CMakeLists.txt`` file. For example:
.. code-block:: cmake
if(NOT snippet1 IN_LIST SNIPPET)
set(SNIPPET snippet1 ${SNIPPET} CACHE STRING "" FORCE)
endif()
find_package(Zephyr ....)