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})