Commit 3dd96d89 authored by Torsten Rasmussen's avatar Torsten Rasmussen Committed by Carles Cufi
Browse files

cmake: Added possibility to disable the printing of version



When ZephyrConfig package is being version checked, then
ZephyrConfigVersion.cmake loads version.cmake.

This causes a print message, such as the following to happen:
-- Zephyr version: 2.2.0

Now, in case a user has multiple Zephyr installations, this could
result in something similar to:
-- Zephyr version: 2.2.0
-- Zephyr version: 2.x.0
-- Zephyr version: 3.x.0
being printed.

This commit add the possibility to disable version printing.

With new Zephyr base find_package, printing of ZEPHYR_BASE is added
after the version, in order to make it easy for users to see which
Zephyr is used.

Signed-off-by: default avatarTorsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Signed-off-by: default avatarMartí Bolívar <marti.bolivar@nordicsemi.no>

suggested change: print ZEPHYR_BASE
parent 81007172
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -61,7 +61,9 @@ endif()

set(PROJECT_VERSION_STR ${PROJECT_VERSION}${PROJECT_VERSION_EXTRA_STR})

message(STATUS "Zephyr version: ${PROJECT_VERSION_STR}")
if (NOT NO_PRINT_VERSION)
  message(STATUS "Zephyr version: ${PROJECT_VERSION_STR} (${ZEPHYR_BASE})")
endif()

set(MAJOR ${PROJECT_VERSION_MAJOR}) # Temporary convenience variable
set(MINOR ${PROJECT_VERSION_MINOR}) # Temporary convenience variable
+4 −0
Original line number Diff line number Diff line
@@ -29,6 +29,10 @@ endif()

# Temporary set local Zephyr base to allow using version.cmake to find this Zephyr tree current version
set(ZEPHYR_BASE ${CMAKE_CURRENT_LIST_DIR}/../../..)

# Tell version.cmake to not print as printing version for all Zephyr installations being tested
# will lead to confusion on which is being used.
set(NO_PRINT_VERSION True)
include(${ZEPHYR_BASE}/cmake/version.cmake)
set(ZEPHYR_BASE)