cmake: cleanup version printing during CMake configure time

Follow-up: #34842

This is a follow-up commit that ensures relevant version information
regarding the build is located together as discussed in #34842.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2021-05-07 11:47:25 +02:00 committed by Anas Nashif
parent 8ff65f4087
commit 2a74dc26de
3 changed files with 6 additions and 3 deletions

View file

@ -147,6 +147,7 @@ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${AUTOCONF_H})
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(${ZEPHYR_BASE}/cmake/extensions.cmake)
include(${ZEPHYR_BASE}/cmake/git.cmake)
include(${ZEPHYR_BASE}/cmake/version.cmake) # depends on hex.cmake
#
@ -155,7 +156,6 @@ include(${ZEPHYR_BASE}/cmake/version.cmake) # depends on hex.cmake
include(${ZEPHYR_BASE}/cmake/python.cmake)
include(${ZEPHYR_BASE}/cmake/west.cmake)
include(${ZEPHYR_BASE}/cmake/git.cmake) # depends on version.cmake
include(${ZEPHYR_BASE}/cmake/ccache.cmake)
if(ZEPHYR_EXTRA_MODULES)

View file

@ -28,5 +28,4 @@ if(NOT DEFINED BUILD_VERSION AND GIT_FOUND)
elseif(NOT "${stderr}" STREQUAL "")
message(STATUS "git describe warned: ${stderr}")
endif()
message(STATUS "BUILD_VERSION=${BUILD_VERSION}")
endif()

View file

@ -61,8 +61,12 @@ endif()
set(PROJECT_VERSION_STR ${PROJECT_VERSION}${PROJECT_VERSION_EXTRA_STR})
if(DEFINED BUILD_VERSION)
set(BUILD_VERSION_STR ", build: ${BUILD_VERSION}")
endif()
if (NOT NO_PRINT_VERSION)
message(STATUS "Zephyr version: ${PROJECT_VERSION_STR} (${ZEPHYR_BASE})")
message(STATUS "Zephyr version: ${PROJECT_VERSION_STR} (${ZEPHYR_BASE})${BUILD_VERSION_STR}")
endif()
set(MAJOR ${PROJECT_VERSION_MAJOR}) # Temporary convenience variable