summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2018-07-29 09:40:31 (GMT)
committerKitware Robot <kwrobot@kitware.com>2018-07-29 09:40:37 (GMT)
commit50e40b7eecf2ca9aca73b6a907227e8191fffe56 (patch)
treeddcfdfe660cab0410fe3591c0ec3b6b8c8ef6263 /Modules
parent7a7e4e9ea323839263dc75cb87e80502a5447d7f (diff)
parented015bde2b6fe526f5f840f43c1c12ba45d5663f (diff)
downloadCMake-50e40b7eecf2ca9aca73b6a907227e8191fffe56.zip
CMake-50e40b7eecf2ca9aca73b6a907227e8191fffe56.tar.gz
CMake-50e40b7eecf2ca9aca73b6a907227e8191fffe56.tar.bz2
Merge topic 'cpack-default-package-version-zero'
ed015bde2b CPack: Restore support for 0-valued version components Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !2239
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CPack.cmake27
1 files changed, 15 insertions, 12 deletions
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 8070869..cdc38a6 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -403,28 +403,31 @@ endfunction()
# Set the package name
_cpack_set_default(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
-if(CMAKE_PROJECT_VERSION_MAJOR)
+
+# Set the package version
+if(CMAKE_PROJECT_VERSION_MAJOR GREATER_EQUAL 0)
_cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "${CMAKE_PROJECT_VERSION_MAJOR}")
- if(CMAKE_PROJECT_VERSION_MINOR)
+ if(CMAKE_PROJECT_VERSION_MINOR GREATER_EQUAL 0)
_cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "${CMAKE_PROJECT_VERSION_MINOR}")
- if(CMAKE_PROJECT_VERSION_PATCH)
+ if(CMAKE_PROJECT_VERSION_PATCH GREATER_EQUAL 0)
_cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "${CMAKE_PROJECT_VERSION_PATCH}")
- _cpack_set_default(CPACK_PACKAGE_VERSION
- "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
- else()
- _cpack_set_default(CPACK_PACKAGE_VERSION
- "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
endif()
- else()
- _cpack_set_default(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}")
endif()
else()
_cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "0")
_cpack_set_default(CPACK_PACKAGE_VERSION_MINOR "1")
_cpack_set_default(CPACK_PACKAGE_VERSION_PATCH "1")
- _cpack_set_default(CPACK_PACKAGE_VERSION
- "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
endif()
+if(NOT DEFINED CPACK_PACKAGE_VERSION)
+ set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}")
+ if(CPACK_PACKAGE_VERSION_MINOR GREATER_EQUAL 0)
+ string(APPEND CPACK_PACKAGE_VERSION ".${CPACK_PACKAGE_VERSION_MINOR}")
+ if(CPACK_PACKAGE_VERSION_PATCH GREATER_EQUAL 0)
+ string(APPEND CPACK_PACKAGE_VERSION ".${CPACK_PACKAGE_VERSION_PATCH}")
+ endif()
+ endif()
+endif()
+
_cpack_set_default(CPACK_PACKAGE_VENDOR "Humanity")
if(CMAKE_PROJECT_DESCRIPTION)
_cpack_set_default(CPACK_PACKAGE_DESCRIPTION_SUMMARY