Document this new build system feature. Since its purpose is customizing application builds, the logical place for the main body of documentation is in a new snippets/ directory in doc/build/. Create that directory and add its initial documentation. Like boards and samples, however, we expect people to write documentation for each snippet within the directory that defines the snippet itself. Therefore, add a new top-level snippets/ directory and stub out the documentation needed to document individual snippets as well. Add documentation and cross-references in other required places as well. Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
39 lines
812 B
ReStructuredText
39 lines
812 B
ReStructuredText
.. _using-snippets:
|
|
|
|
Using Snippets
|
|
##############
|
|
|
|
.. tip::
|
|
|
|
See :ref:`built-in-snippets` for a list of snippets that are provided by
|
|
Zephyr.
|
|
|
|
Snippets have names. You use snippets by giving their names to the build
|
|
system.
|
|
|
|
With west build
|
|
***************
|
|
|
|
To use a snippet named ``foo`` when building an application ``app``:
|
|
|
|
.. code-block:: console
|
|
|
|
west build -S foo app
|
|
|
|
To use multiple snippets:
|
|
|
|
.. code-block:: console
|
|
|
|
west build -S snippet1 -S snippet2 [...] app
|
|
|
|
With cmake
|
|
**********
|
|
|
|
If you are running CMake directly instead of using ``west build``, use the
|
|
``SNIPPET`` variable. This is a whitespace- or semicolon-separated list of
|
|
snippet names you want to use. For example:
|
|
|
|
.. code-block:: console
|
|
|
|
cmake -Sapp -Bbuild -DSNIPPET="snippet1;snippet2" [...]
|
|
cmake --build build
|