From 3dd96d892706a9c76e48416f34128c5251f272f9 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Fri, 14 Feb 2020 14:16:06 +0100 Subject: [PATCH] cmake: Added possibility to disable the printing of version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: Torsten Rasmussen Signed-off-by: Martí Bolívar suggested change: print ZEPHYR_BASE --- cmake/version.cmake | 4 +++- share/zephyr-package/cmake/ZephyrConfigVersion.cmake | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/version.cmake b/cmake/version.cmake index 08dc1e0d08e..f80a6799bae 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -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 diff --git a/share/zephyr-package/cmake/ZephyrConfigVersion.cmake b/share/zephyr-package/cmake/ZephyrConfigVersion.cmake index aca4713272d..9dedbca4941 100644 --- a/share/zephyr-package/cmake/ZephyrConfigVersion.cmake +++ b/share/zephyr-package/cmake/ZephyrConfigVersion.cmake @@ -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)