From c9ef484d7f85adfe9c4043f8e087966966739b0a Mon Sep 17 00:00:00 2001 From: Diogo Matsubara Date: Tue, 25 Jun 2024 14:30:06 +0200 Subject: [PATCH] Align version with zenoh-c (#138) As per https://github.com/eclipse-zenoh/zenoh-c/pull/466, align how we configure zenoh CMake based projects version. --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41f34f36..1dcdbb4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,16 @@ project( set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) include(helpers) +set(project_version "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") +if(NOT DEFINED PROJECT_VERSION_TWEAK) + set(project_version "${project_version}") +elseif(PROJECT_VERSION_TWEAK EQUAL 0) + set(project_version "${project_version}-dev") +elseif(PROJECT_VERSION_TWEAK GREATER 1) + set(project_version "${project_version}-pre.${PROJECT_VERSION_TWEAK}") +endif() +status_print(project_version) + if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) # Temporary measure. Ideally zenoh-cpp should work with any variant # of zenoh-c build