@@ -5,9 +5,14 @@ Zephyr CMake Package
55
66The Zephyr `CMake package `_ is a convenient way to create a Zephyr-based application.
77
8- The Zephyr CMake package ensures that CMake can automatically select a Zephyr to use for building
9- the application, whether it is a Zephyr repository application, Zephyr workspace application, or a
10- Zephyr freestanding application.
8+ .. note ::
9+ The :ref: `zephyr-app-types ` section introduces the application types
10+ used in this page.
11+
12+ The Zephyr CMake package ensures that CMake can automatically select a Zephyr installation to use for building
13+ the application, whether it is a :ref: `Zephyr repository application <zephyr-repo-app >`,
14+ a :ref: `Zephyr workspace application <zephyr-workspace-app >`, or a
15+ :ref: `Zephyr freestanding application <zephyr-freestanding-app >`.
1116
1217When developing a Zephyr-based application, then a developer simply needs to write
1318``find_package(Zephyr) `` in the beginning of the application :file: `CMakeLists.txt ` file.
@@ -68,87 +73,8 @@ To also export the Zephyr Unittest CMake package, run the following command in a
6873
6974 cmake -P < PATH-TO-ZEPHYR> /share/zephyrunittest-package/cmake/zephyr_export.cmake
7075
71-
7276 .. _zephyr_cmake_package_zephyr_base :
7377
74-
75- Zephyr application structure
76- ****************************
77-
78- An application can be placed anywhere on your disk, but to better understand how the Zephyr
79- package is used, we will name three specific layouts.
80-
81-
82- Zephyr repository application
83- =============================
84-
85- A Zephyr repository has the following structure:
86-
87- .. code-block :: none
88-
89- <projects>/zephyr-workspace
90- └── zephyr
91- ├── arch
92- ├── boards
93- ├── cmake
94- ├── samples
95- │ ├── hello_world
96- │ └── ...
97- ├── tests
98- └── ...
99-
100- Any application located inside this tree, is simply referred to as a Zephyr repository application.
101- In this example ``hello_world `` is a Zephyr repository application.
102-
103-
104- Zephyr workspace application
105- ============================
106-
107- A Zephyr workspace has the following structure:
108-
109- .. code-block :: none
110-
111- <projects>/zephyr-workspace
112- ├── zephyr
113- ├── bootloader
114- ├── modules
115- ├── tools
116- ├── <vendor/private-repositories>
117- └── my_applications
118- └── my_first_app
119-
120- Any application located in such workspace, but outside the Zephyr repository itself, is referred to
121- as a Zephyr workspace application.
122- In this example ``my_first_app `` is a Zephyr workspace application.
123-
124- .. note :: The root of a Zephyr workspace is identical to ``west topdir`` if the workspace was
125- installed using ``west ``
126-
127-
128- .. _freestanding_application :
129-
130- Zephyr freestanding application
131- ===============================
132-
133- A Zephyr freestanding application is a Zephyr application located outside of a Zephyr workspace.
134-
135-
136- .. code-block :: none
137-
138- <projects>/zephyr-workspace
139- ├── zephyr
140- ├── bootloader
141- └── ...
142-
143- <home>/app
144- ├── CMakeLists.txt
145- ├── prj.conf
146- └── src
147- └── main.c
148-
149- In this example ``app `` is a Zephyr freestanding application.
150-
151-
15278Zephyr Base Environment Setting
15379*******************************
15480
@@ -198,6 +124,9 @@ the following criteria will be used:
198124 in this example, ``my_first_app `` will use ``<projects>/zephyr-workspace/zephyr `` as this Zephyr
199125 is located in the same workspace as the Zephyr workspace application.
200126
127+ .. note ::
128+ The root of a Zephyr workspace is identical to ``west topdir `` if the workspace was
129+ installed using ``west ``
201130
202131* Zephyr freestanding application will use the Zephyr registered in the CMake user package registry.
203132 For example:
@@ -451,7 +380,7 @@ Zephyr Build Configuration CMake package (Freestanding application)
451380*******************************************************************
452381
453382The Zephyr Build Configuration CMake package can be located outside a Zephyr
454- workspace, for example located with a :ref: `freestanding_application `.
383+ workspace, for example located with a :ref: `zephyr-freestanding-app `.
455384
456385Create the build configuration as described in the previous section, and then
457386refer to the location of your Zephyr Build Configuration CMake package using
0 commit comments