Move Zephyr CMake script mode handling from package_helper.cmake into
extensions.cmake.
This ensures that all Zephyr CMake script which includes
extensions.cmake will have the same functions stubbed or mocked and thus
does not need to replicate this behavior.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Fixes: #63011
Custom targets are not available in script mode, which cause snippet
loading to fail when using package helper.
Lookup of snippets is supported by package helper, thus allowing twister
to filter test cases based on snippets.
However, loading of snippets itself is not supported as snippets make
use of Zephyr scoping, which uses custom targets, something that is not
available in script mode.
Therefore overload the `zephyr_set()` function, so that CMake package
helper can be used together with snippets.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Update package_helper.cmake to use EXTRA_CONF_FILE instead of deprecated
OVERLAY_CONFIG variable.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
CMake versions <3.20.5 contains the following bug:
https://gitlab.kitware.com/cmake/cmake/-/issues/22310
This bug was fixed in CMake 3.20.5:
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6232
Generally Zephyr can build with CMake >=3.20.0, however the
`cmake/package_helper.cmake` is impacted by the above issue.
Therefore, specifically request CMake >=3.20.5 for package helper
and update documentation to recommend CMake version 3.20.5 in order
to minimize risk of users being impacted by this bug.
Users invoking package helper with CMake 3.20.0-3.20.4 will see:
> CMake Error at cmake/package_helper.cmake:45 (cmake_minimum_required):
> CMake 3.20.5 or higher is required. You are running version 3.20.x
Rest of Zephyr still builds with CMake versions >=3.20.0.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
As Zephyr currently requires CMake version 3.20.0, update all
occurrences of cmake_minimum_required.
Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
The Zephyr CMake package helper script allows to invoke Zephyr package
modules as they are invoked at configure time, up to the modules given
with `-DMODULES=<modules>`.
This allows to run the configure time part of the Zephyr build system
without generating a complete build system.
This means that for example devicetree module can be invoked for a given
sample and board to generate zephyr.dts identical to what is created
by the build system during a build.
To generate zephyr.dts for hello_world, invoke the script as:
$ cmake -DBOARD=<board> -B build -S samples/hello_world \
$ -DMODULES=dts -P <ZEPHYR_BASE>/cmake/package_helper.cmake
Other modules, for example 'kconfig' and 'zephyr_modules' can also be
invoked this way.
This will allow other tools, such as twister, to executed only a
subset of the build system like dts in order to do filtering before
determine if a complete build should be invoked.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>