Set version in one place

This commit is contained in:
vitaut 2015-11-11 07:22:07 -08:00
parent 0550f1217c
commit 89cd4a5e17

View File

@ -126,11 +126,14 @@ if (FMT_TEST)
add_subdirectory(test) add_subdirectory(test)
endif () endif ()
set(CPACK_PACKAGE_VERSION_MAJOR 1) set(CPPFORMAT_VERSION 1.2.0)
set(CPACK_PACKAGE_VERSION_MINOR 2) if (NOT CPPFORMAT_VERSION MATCHES "^([0-9]+).([0-9]+).([0-9]+)$")
set(CPACK_PACKAGE_VERSION_PATCH 0) message(FATAL_ERROR "Invalid version format ${CPPFORMAT_VERSION}.")
set(CPPFORMAT_VERSION endif ()
${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) 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 set_target_properties(cppformat PROPERTIES
VERSION ${CPPFORMAT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}) VERSION ${CPPFORMAT_VERSION} SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR})