diff options
author | Craig Scott <craig.scott@crascit.com> | 2018-07-29 09:44:24 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2018-07-29 09:44:24 (GMT) |
commit | 2af530731707491c8da7c76cfe6ecd35d7c36e57 (patch) | |
tree | 77eb5e8fec07eb5884bdd30db16785b5f9215a14 | |
parent | 8442d9fc3fe71c12dd613ba585b196da93d6d9f1 (diff) | |
parent | ed015bde2b6fe526f5f840f43c1c12ba45d5663f (diff) | |
download | CMake-2af530731707491c8da7c76cfe6ecd35d7c36e57.zip CMake-2af530731707491c8da7c76cfe6ecd35d7c36e57.tar.gz CMake-2af530731707491c8da7c76cfe6ecd35d7c36e57.tar.bz2 |
Merge branch 'cpack-default-package-version-zero' into release-3.12
Merge-request: !2239
-rw-r--r-- | Modules/CPack.cmake | 27 | ||||
-rw-r--r-- | Tests/RunCMake/CPackConfig/RunCMakeTest.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CPackConfig/Version1-check.cmake | 6 | ||||
-rw-r--r-- | Tests/RunCMake/CPackConfig/Version1.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CPackConfig/Version2-check.cmake | 6 | ||||
-rw-r--r-- | Tests/RunCMake/CPackConfig/Version2.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CPackConfig/Version3-check.cmake | 6 | ||||
-rw-r--r-- | Tests/RunCMake/CPackConfig/Version3.cmake | 1 |
8 files changed, 39 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 diff --git a/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake b/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake index 16d2cf3..8f2196d 100644 --- a/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake @@ -4,3 +4,6 @@ run_cmake(Simple) run_cmake(Default) run_cmake(Special) run_cmake(Verbatim) +run_cmake(Version1) +run_cmake(Version2) +run_cmake(Version3) diff --git a/Tests/RunCMake/CPackConfig/Version1-check.cmake b/Tests/RunCMake/CPackConfig/Version1-check.cmake new file mode 100644 index 0000000..0f5347f --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Version1-check.cmake @@ -0,0 +1,6 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_variable(CPACK_PACKAGE_VERSION "0") +test_variable(CPACK_PACKAGE_VERSION_MAJOR "0") +test_variable(CPACK_PACKAGE_VERSION_MINOR "") +test_variable(CPACK_PACKAGE_VERSION_PATCH "") diff --git a/Tests/RunCMake/CPackConfig/Version1.cmake b/Tests/RunCMake/CPackConfig/Version1.cmake new file mode 100644 index 0000000..703485c --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Version1.cmake @@ -0,0 +1 @@ +project(Version LANGUAGES NONE VERSION 0) diff --git a/Tests/RunCMake/CPackConfig/Version2-check.cmake b/Tests/RunCMake/CPackConfig/Version2-check.cmake new file mode 100644 index 0000000..3a2d572 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Version2-check.cmake @@ -0,0 +1,6 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_variable(CPACK_PACKAGE_VERSION "1.0") +test_variable(CPACK_PACKAGE_VERSION_MAJOR "1") +test_variable(CPACK_PACKAGE_VERSION_MINOR "0") +test_variable(CPACK_PACKAGE_VERSION_PATCH "") diff --git a/Tests/RunCMake/CPackConfig/Version2.cmake b/Tests/RunCMake/CPackConfig/Version2.cmake new file mode 100644 index 0000000..c084137 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Version2.cmake @@ -0,0 +1 @@ +project(Version LANGUAGES NONE VERSION 1.0) diff --git a/Tests/RunCMake/CPackConfig/Version3-check.cmake b/Tests/RunCMake/CPackConfig/Version3-check.cmake new file mode 100644 index 0000000..d4a3983 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Version3-check.cmake @@ -0,0 +1,6 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_variable(CPACK_PACKAGE_VERSION "1.1.0") +test_variable(CPACK_PACKAGE_VERSION_MAJOR "1") +test_variable(CPACK_PACKAGE_VERSION_MINOR "1") +test_variable(CPACK_PACKAGE_VERSION_PATCH "0") diff --git a/Tests/RunCMake/CPackConfig/Version3.cmake b/Tests/RunCMake/CPackConfig/Version3.cmake new file mode 100644 index 0000000..4df28bb --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Version3.cmake @@ -0,0 +1 @@ +project(Version LANGUAGES NONE VERSION 1.1.0) |