From 636fdeba70726dfa092bafdd7ec5b1e2f60c0490 Mon Sep 17 00:00:00 2001 From: def Date: Sun, 14 Jan 2018 15:31:31 +0100 Subject: [PATCH] cpack should get shorter version name as well --- CMakeLists.txt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 35618d485..26072b4f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,13 +19,21 @@ endif() if(POLICY CMP0048) cmake_policy(SET CMP0048 NEW) - project(DDNet VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) + if(VERSION_PATCH STREQUAL "0") + project(DDNet VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) + else() + project(DDNet VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) + endif() else() project(DDNet) set(PROJECT_VERSION_MAJOR ${VERSION_MAJOR}) set(PROJECT_VERSION_MINOR ${VERSION_MINOR}) set(PROJECT_VERSION_PATCH ${VERSION_PATCH}) - set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) + if(VERSION_PATCH STREQUAL "0") + set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}) + else() + set(PROJECT_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) + endif() endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) @@ -1187,7 +1195,11 @@ set(CPACK_SOURCE_GENERATOR ZIP TGZ TBZ2 TXZ) set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) -set(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) +if(VERSION_PATCH STREQUAL "0") + set(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}) +else() + set(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) +endif() set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) if(TARGET_OS AND TARGET_BITS)