diff --git a/cmake/Version.cmake b/cmake/Version.cmake index 957e29ca4..bb01315ab 100644 --- a/cmake/Version.cmake +++ b/cmake/Version.cmake @@ -20,15 +20,15 @@ if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git") if (res EQUAL 1) set (PROJECT_VERSION "${PROJECT_VERSION}-dirty") endif() -endif() -string(REGEX REPLACE "^(0|[1-9][0-9]*)[.](0|[1-9][0-9]*)[.](0|[1-9][0-9]*)(-[.0-9A-Za-z-]+)?([+][.0-9A-Za-z-]+)?$" - "\\1;\\2;\\3" PROJECT_VERSION_LIST ${PROJECT_VERSION}) -list(LENGTH PROJECT_VERSION_LIST len) -if(len EQUAL 3) - list(GET PROJECT_VERSION_LIST 0 PROJECT_VERSION_MAJOR) - list(GET PROJECT_VERSION_LIST 1 PROJECT_VERSION_MINOR) - list(GET PROJECT_VERSION_LIST 2 PROJECT_VERSION_PATCH) + string(REGEX REPLACE "^(0|[1-9][0-9]*)[.](0|[1-9][0-9]*)[.](0|[1-9][0-9]*)(-[.0-9A-Za-z-]+)?([+][.0-9A-Za-z-]+)?$" + "\\1;\\2;\\3" PROJECT_VERSION_LIST ${PROJECT_VERSION}) + list(LENGTH PROJECT_VERSION_LIST len) + if(len EQUAL 3) + list(GET PROJECT_VERSION_LIST 0 PROJECT_VERSION_MAJOR) + list(GET PROJECT_VERSION_LIST 1 PROJECT_VERSION_MINOR) + list(GET PROJECT_VERSION_LIST 2 PROJECT_VERSION_PATCH) + endif() elseif(EXISTS ${PROJECT_SOURCE_DIR}/.version) # If git is not available (e.g. when building from source package) # we can extract the package version from .version file. @@ -44,7 +44,5 @@ else() message(FATAL_ERROR "Unable to determine project version") endif() -if (${CMAKE_BUILD_TYPE} MATCHES "Debug") - message(STATUS "stlink version: ${PROJECT_VERSION}") - message(STATUS " Major ${PROJECT_VERSION_MAJOR} Minor ${PROJECT_VERSION_MINOR} Patch ${PROJECT_VERSION_PATCH}") -endif() +message(STATUS "stlink version: ${PROJECT_VERSION}") +message(STATUS " Major ${PROJECT_VERSION_MAJOR} Minor ${PROJECT_VERSION_MINOR} Patch ${PROJECT_VERSION_PATCH}")