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 <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2020-02-17 10:14:09 -05:00
commit ef486b2c50

View file

@ -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