From ef486b2c503783c7f110814ed98ceda2ff060044 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Mon, 17 Feb 2020 10:14:09 -0500 Subject: [PATCH] cmake: report extra version (rcX) Right now when building a release candidate in master cmake reports the version wrongly as the final version, for example: -- Zephyr version: 2.2.0 This is misleading and confusing. Cmake does not like the rcX suffix and internally we indeed use 2.2.0 as the version. This patch just changes the output of the status message and adds the extra version field: -- Zephyr version: 2.2.0-rc1 and continues to use the cmake compatible version internally. Signed-off-by: Anas Nashif --- cmake/version.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/version.cmake b/cmake/version.cmake index fa9430887d4..08dc1e0d08e 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -48,13 +48,20 @@ set(PROJECT_VERSION_EXTRA ${CMAKE_MATCH_1}) # Temporary convenience variable set(PROJECT_VERSION_WITHOUT_TWEAK ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}) + +if(PROJECT_VERSION_EXTRA) + set(PROJECT_VERSION_EXTRA_STR "-${PROJECT_VERSION_EXTRA}") +endif() + if(PROJECT_VERSION_TWEAK) set(PROJECT_VERSION ${PROJECT_VERSION_WITHOUT_TWEAK}.${PROJECT_VERSION_TWEAK}) else() set(PROJECT_VERSION ${PROJECT_VERSION_WITHOUT_TWEAK}) endif() -message(STATUS "Zephyr version: ${PROJECT_VERSION}") +set(PROJECT_VERSION_STR ${PROJECT_VERSION}${PROJECT_VERSION_EXTRA_STR}) + +message(STATUS "Zephyr version: ${PROJECT_VERSION_STR}") set(MAJOR ${PROJECT_VERSION_MAJOR}) # Temporary convenience variable set(MINOR ${PROJECT_VERSION_MINOR}) # Temporary convenience variable