diff --git a/cmake/app/boilerplate.cmake b/cmake/app/boilerplate.cmake index 5ff6a19ea2..30b6dbb4bc 100644 --- a/cmake/app/boilerplate.cmake +++ b/cmake/app/boilerplate.cmake @@ -208,11 +208,11 @@ list(APPEND ARCH_ROOT ${ZEPHYR_BASE}) # Check that BOARD has been provided, and that it has not changed. zephyr_check_cache(BOARD REQUIRED) -string(FIND "${BOARD}" "@" REVIVISION_SEPARATOR_INDEX) -if(NOT (REVIVISION_SEPARATOR_INDEX EQUAL -1)) - math(EXPR BOARD_REVISION_INDEX "${REVIVISION_SEPARATOR_INDEX} + 1") +string(FIND "${BOARD}" "@" REVISION_SEPARATOR_INDEX) +if(NOT (REVISION_SEPARATOR_INDEX EQUAL -1)) + math(EXPR BOARD_REVISION_INDEX "${REVISION_SEPARATOR_INDEX} + 1") string(SUBSTRING ${BOARD} ${BOARD_REVISION_INDEX} -1 BOARD_REVISION) - string(SUBSTRING ${BOARD} 0 ${REVIVISION_SEPARATOR_INDEX} BOARD) + string(SUBSTRING ${BOARD} 0 ${REVISION_SEPARATOR_INDEX} BOARD) endif() set(BOARD_MESSAGE "Board: ${BOARD}") diff --git a/cmake/extensions.cmake b/cmake/extensions.cmake index 1b95b40c5f..9d4e4d93a4 100644 --- a/cmake/extensions.cmake +++ b/cmake/extensions.cmake @@ -797,7 +797,7 @@ endfunction() # # FORMAT : Specify the revision format. # LETTER: Revision format is a single letter from A - Z. -# MAJOR.MINOR.PATCH: Revision format is three digits, separated by `.`, +# MAJOR.MINOR.PATCH: Revision format is three numbers, separated by `.`, # `x.y.z`. Trailing zeroes may be omitted on the # command line, which means: # 1.0.0 == 1.0 == 1 @@ -859,10 +859,10 @@ function(board_check_revision) if(BOARD_REV_FORMAT STREQUAL LETTER) set(revision_regex "([A-Z])") elseif(BOARD_REV_FORMAT MATCHES "^MAJOR\.MINOR\.PATCH$") - set(revision_regex "((0|[1-9]+)(\.[0-9]+)(\.[0-9]+))") + set(revision_regex "((0|[1-9][0-9]*)(\.[0-9]+)(\.[0-9]+))") # We allow loose @ typing on command line. # so append missing zeroes. - if(BOARD_REVISION MATCHES "((0|[1-9]+)(\.[0-9]+)?(\.[0-9]+)?)") + if(BOARD_REVISION MATCHES "((0|[1-9][0-9]*)(\.[0-9]+)?(\.[0-9]+)?)") if(NOT CMAKE_MATCH_3) set(BOARD_REVISION ${BOARD_REVISION}.0) set(BOARD_REVISION ${BOARD_REVISION} PARENT_SCOPE) @@ -874,7 +874,7 @@ function(board_check_revision) endif() else() message(FATAL_ERROR "Invalid format specified for \ - `zephyr_check_board_revision(FORMAT )`") + `board_check_revision(FORMAT )`") endif() if(NOT (BOARD_REVISION MATCHES "^${revision_regex}$"))