Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: function to update Zephyr_DIR when loading old Zephyr packages
Fixes: zephyrproject-rtos#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 zephyrproject-rtos#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 <[email protected]>
- Loading branch information