@@ -125,6 +125,8 @@ In this example ``my_first_app`` is a Zephyr workspace application.
125125 installed using ``west ``
126126
127127
128+ .. _freestanding_application :
129+
128130Zephyr freestanding application
129131===============================
130132
@@ -453,6 +455,48 @@ A sample ``ZephyrBuildConfig.cmake`` can be seen below.
453455 endif()
454456 endif()
455457
458+ Zephyr Build Configuration CMake package (Freestanding application)
459+ *******************************************************************
460+
461+ The Zephyr Build Configuration CMake package can be located outside a Zephyr
462+ workspace, for example located with a :ref: `freestanding_application `.
463+
464+ Create the build configuration as described in the previous section, and then
465+ refer to the location of your Zephyr Build Configuration CMake package using
466+ the CMake variable ``ZephyrBuildConfiguration_ROOT ``.
467+
468+ #. At the CMake command line, like this:
469+
470+ .. code-block :: console
471+
472+ cmake -DZephyrBuildConfiguration_ROOT=<path-to-build-config> ...
473+
474+ #. At the top of your application's top level :file: `CMakeLists.txt `, like this:
475+
476+ .. code-block :: cmake
477+
478+ set(ZephyrBuildConfiguration_ROOT <path-to-build-config>)
479+ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
480+
481+ If you choose this option, make sure to set the variable **before ** calling
482+ ``find_package(Zephyr ...) ``, as shown above.
483+
484+ #. In a separate CMake script which is pre-loaded to populate the CMake cache,
485+ like this:
486+
487+ .. code-block :: cmake
488+
489+ # Put this in a file with a name like "zephyr-settings.cmake"
490+ set(ZephyrBuildConfiguration_ROOT <path-to-build-config>
491+ CACHE STRING "pre-cached build config"
492+ )
493+
494+ You can tell the build system to use this file by adding ``-C
495+ zephyr-settings.cmake `` to your CMake command line.
496+ This principle is useful when not using ``west `` as both this setting and
497+ Zephyr modules can be specified using the same file.
498+ See Zephyr module :ref: `modules_without_west `.
499+
456500Zephyr CMake package source code
457501********************************
458502
0 commit comments