zephyr/share/zephyr-package/cmake
Torsten Rasmussen f96ee77c7c cmake: function to update Zephyr_DIR when loading old Zephyr packages
Fixes: #43094

This commit introduces a function which updates Zephyr_DIR to point to
the directory of the Zephyr package being loaded.

For Zephyr 3.0 and earlier, the Zephyr_DIR might in some cases be
`Zephyr_DIR-NOTFOUND` or pointing to the Zephyr package including the
boilerplate code instead of the Zephyr package of the included
boilerplate code.

This code ensures that when a package is loaded then Zephyr_DIR will
point correctly.
This ensures that when Zephyr releases <=3.0 is loaded, then Zephyr_DIR
will point correctly, see more in #43094.

Old style Zephyr package will in some cases load boilerplate.cmake
directly so to ensure proper behavior, restrict boilerplate uses of
`find_package(Zephyr)` to not use default search path, but allow only
the current Zephyr.

Of the same reason, only print warning if Zephyr_DIR is not defined as
this indicates old style inclusion.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2022-03-07 16:35:54 +01:00
..
ZephyrConfig.cmake cmake: set Zephyr_DIR when loading Zephyr package 2022-03-07 16:35:54 +01:00
ZephyrConfigVersion.cmake cmake: Zephyr CMake package and CMake modules 2022-02-22 10:02:39 -08:00
zephyr_export.cmake cmake: using MD5_INFILE variable instead of ZephyrPackagePath.txt 2021-02-23 19:34:27 +01:00
zephyr_package_search.cmake cmake: function to update Zephyr_DIR when loading old Zephyr packages 2022-03-07 16:35:54 +01:00