From 89cd4a5e170011d70ccf5410168c635405c233ac Mon Sep 17 00:00:00 2001 From: vitaut Date: Wed, 11 Nov 2015 07:22:07 -0800 Subject: [PATCH] Set version in one place --- CMakeLists.txt | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fb4a707..7b67f1ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,11 +126,14 @@ if (FMT_TEST) add_subdirectory(test) endif () -set(CPACK_PACKAGE_VERSION_MAJOR 1) -set(CPACK_PACKAGE_VERSION_MINOR 2) -set(CPACK_PACKAGE_VERSION_PATCH 0) -set(CPPFORMAT_VERSION - ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) +set(CPPFORMAT_VERSION 1.2.0) +if (NOT CPPFORMAT_VERSION MATCHES "^([0-9]+).([0-9]+).([0-9]+)$") + message(FATAL_ERROR "Invalid version format ${CPPFORMAT_VERSION}.") +endif () +set(CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1}) +set(CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2}) +set(CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3}) + set_target_properties(cppformat PROPERTIES VERSION ${CPPFORMAT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR})