foreach(root ${BOARD_ROOT})#Check that the board root looks reasonable.if(NOT IS_DIRECTORY "${root}/boards")message(WARNING "BOARD_ROOT element without a 'boards' subdirectory:
${root}
Hints:-if your board directory is '/foo/bar/boards/<ARCH>/my_board' then add '/foo/bar' to BOARD_ROOT, not the entire board directory
-if in doubt, use absolute paths")endif()#NB: find_path will return immediately if the output variable is#alreadysetif(BOARD_ALIAS)find_path(BOARD_HIDDEN_DIR
NAMES ${BOARD_ALIAS}_defconfig
PATHS ${root}/boards/*/*
NO_DEFAULT_PATH
)
if(BOARD_HIDDEN_DIR)
message("Board alias ${BOARD_ALIAS} is hiding the real board of same name")
endif()
endif()
if(BOARD_DIR AND NOT EXISTS ${BOARD_DIR}/${BOARD}_defconfig)
message(WARNING "BOARD_DIR: ${BOARD_DIR} has been moved or deleted. "
"Trying to find new location."
)
set(BOARD_DIR BOARD_DIR-NOTFOUND CACHE PATH "Path to a file." FORCE)
endif()
find_path(BOARD_DIR
NAMES ${BOARD}_defconfig
PATHS ${root}/boards/*/*
NO_DEFAULT_PATH
)if(BOARD_DIR AND NOT(${root} STREQUAL ${ZEPHYR_BASE}))set(USING_OUT_OF_TREE_BOARD 1)endif()endforeach()