From 2a74dc26de62b8f31e427b8fb3f8a5ebf6ca9574 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Fri, 7 May 2021 11:47:25 +0200 Subject: [PATCH] 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 --- cmake/app/boilerplate.cmake | 2 +- cmake/git.cmake | 1 - cmake/version.cmake | 6 +++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmake/app/boilerplate.cmake b/cmake/app/boilerplate.cmake index a27ee5b80d..d5208b8fb3 100644 --- a/cmake/app/boilerplate.cmake +++ b/cmake/app/boilerplate.cmake @@ -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) diff --git a/cmake/git.cmake b/cmake/git.cmake index 0c9d5e15b0..fa79e30a54 100644 --- a/cmake/git.cmake +++ b/cmake/git.cmake @@ -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() diff --git a/cmake/version.cmake b/cmake/version.cmake index f80a6799ba..326a33ca2a 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -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