From d323acafc3f85268e7749142f1b7c2cccaee04d9 Mon Sep 17 00:00:00 2001 From: Jordan Yates Date: Sat, 27 Jan 2024 12:22:42 +1000 Subject: [PATCH] doc: build: snippets: application required snippets Document how an application can automatically include snippets when being built. Signed-off-by: Jordan Yates --- doc/build/snippets/using.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/build/snippets/using.rst b/doc/build/snippets/using.rst index 608e2924302e..74557ce7bff9 100644 --- a/doc/build/snippets/using.rst +++ b/doc/build/snippets/using.rst @@ -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 ....)