cmake: set Zephyr_DIR when loading Zephyr package
CMake find_package() is expected to set the cached variable Zephyr_DIR
with the value of the package included.
Zephyr_DIR in the CMakeCache is used by CMake re-runs for
`find_package(Zephyr)` to directly lookup the package to use.
The Zephyr_DIR is set correctly when a single Zephyr workspace is used
but may in some other cases be set to `Zephyr_DIR=Zephyr_DIR-NOTFOUND`.
This causes CMake to rerun the Zephyr package search mechanism and loop
through potential candidates before loading the correct Zephyr
installation.
After a second run, Zephyr_DIR is n some cases set to
`Zephyr_DIR=<path-to-including-Zephyr>` which might be different from
the Zephyr in use.
The Zephyr_DIR should be pointing to the package defined by ZEPHYR_BASE.
This commit ensures that when ZephyrConfig.cmake package is loaded, then
Zephyr_DIR is set correctly.
Signed-off-by:
Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Loading
Please sign in to comment