From 74397ccbe3fe4504687480e02b74552a9ba69733 Mon Sep 17 00:00:00 2001 From: Pascal Bach Date: Tue, 24 Jun 2014 12:23:50 +0200 Subject: [PATCH] cmake: read the version information from VERSION The version inforamtion for CMake is extracted from the VERSION file not hardcoded in CMakeLists.txt Reviewed-by: Roger Meier --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb2213c4e..2a26bafa5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,9 +9,13 @@ cmake_minimum_required(VERSION 2.8.0) set(SHARED_LIBRARY_VERSION "22") -set(CPACK_PACKAGE_VERSION_MAJOR "1") -set(CPACK_PACKAGE_VERSION_MINOR "5") -set(CPACK_PACKAGE_VERSION_PATCH "2") +# Read the version information from the VERSION file +file (STRINGS "${CMAKE_SOURCE_DIR}/VERSION" PACKAGE_VERSION ) +message(STATUS "Poco package version: ${PACKAGE_VERSION}") +string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" CPACK_PACKAGE_VERSION_MAJOR ${PACKAGE_VERSION}) +string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" CPACK_PACKAGE_VERSION_MINOR ${PACKAGE_VERSION}) +string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" CPACK_PACKAGE_VERSION_PATCH ${PACKAGE_VERSION}) + SET(COMPLETE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) SET(RELEASE_NAME "Unstable-trunk") SET(PROJECT_VERSION ${COMPLETE_VERSION})