diff --git a/cmake/modules/boards.cmake b/cmake/modules/boards.cmake index ee81b264c1f..f76d89a8427 100644 --- a/cmake/modules/boards.cmake +++ b/cmake/modules/boards.cmake @@ -195,6 +195,24 @@ endif() if(NOT "${ret_board}" STREQUAL "") string(STRIP "${ret_board}" ret_board) + string(FIND "${ret_board}" "\n" idx REVERSE) + if(idx GREATER -1) + while(TRUE) + math(EXPR start "${idx} + 1") + string(SUBSTRING "${ret_board}" ${start} -1 line) + string(SUBSTRING "${ret_board}" 0 ${idx} ret_board) + + cmake_parse_arguments(LIST_BOARD "" "DIR" "" ${line}) + set(board_dirs "${board_dirs}\n${LIST_BOARD_DIR}") + + if(idx EQUAL -1) + break() + endif() + string(FIND "${ret_board}" "\n" idx REVERSE) + endwhile() + message(FATAL_ERROR "Multiple boards named '${BOARD}' found in:${board_dirs}") + endif() + set(single_val "NAME;DIR;HWM;REVISION_FORMAT;REVISION_DEFAULT;REVISION_EXACT") set(multi_val "REVISIONS;SOCS;QUALIFIERS") cmake_parse_arguments(LIST_BOARD "" "${single_val}" "${multi_val}" ${ret_board})