cmake: Fall back to ZEPHYR_BASE when the board is not in BOARD_ROOT

It is very inconvenient to maintain an application that both runs on a
Zephyr board and an out-of-tree board.

It forces one to write build scripts like this in the app:

if(BOARD STREQUAL my_out_of_tree_board)
  set(BOARD_ROOT some/out/of/tree/board/path)
endif()

To avoid this we change the semantics of BOARD_ROOT. Instead of it
being a path to the board root it is now a prioritized list of board
root directories. Zephyr will append ZEPHYR_BASE to BOARD_ROOT.

This ensures that Zephyr boards can be used when the out-of-tree board
directory can not supply the requested board.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2018-09-27 18:10:22 +02:00 committed by Anas Nashif
commit d6de4c7a99
6 changed files with 43 additions and 27 deletions

View file

@ -2,7 +2,7 @@
# error if it is missing
if(EXISTS ${BOARD_DIR}/CMakeLists.txt)
if(BOARD_ROOT)
if(USING_OUT_OF_TREE_BOARD)
set(build_dir boards/${ARCH}/${BOARD})
else()
unset(build_dir)