Part 1
요약·해설
-S, SNIPPET variable, CMakeLists.txt cache 설정을 실제 명령으로 보존했습니다.
-S
-S 반복
SNIPPET
CMakeLists.txt
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
082205C599C78A3772EF1F285D56F7B0119B93D6E02922E27B9575990004832E
.. _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
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 ....)
Part 3
한국어 전문 번역
Snippet 사용
Snippet에는 이름이 있으며 build system에 그 이름을 전달해 사용합니다. Zephyr가 제공하는 목록은 built-in snippet 문서에서 확인할 수 있습니다.
west build에서 사용
app application을 build할 때 이름이 foo인 snippet을 사용합니다.
west build -S foo app여러 snippet은 -S option을 반복합니다.
west build -S snippet1 -S snippet2 [...] appCMake에서 사용
west build 대신 CMake를 직접 실행한다면 SNIPPET variable을 사용합니다. 공백 또는 semicolon으로 구분한 snippet 이름 목록입니다.
cmake -Sapp -Bbuild -DSNIPPET="snippet1;snippet2" [...]
cmake --build buildApplication이 항상 요구하는 snippet
Application을 항상 특정 snippet과 compile해야 한다면 application의 CMakeLists.txt에 추가합니다.
if(NOT snippet1 IN_LIST SNIPPET)
set(SNIPPET snippet1 ${SNIPPET} CACHE STRING "" FORCE)
endif()
find_package(Zephyr ....)이미 목록에 없을 때만 snippet1을 cache variable 앞에 추가하고, 그 뒤 find_package(Zephyr ...)를 호출합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.