From ce76fc5735c97d11035a98d9eefb31e5dff587bf Mon Sep 17 00:00:00 2001 From: Zhichang Yu Date: Mon, 1 Jul 2024 15:47:13 +0800 Subject: [PATCH] Calibrate CPACK_PACKAGE_VERSION --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2cfc0c04c..feb84411ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,7 +188,12 @@ endif () # CPack settings set(CPACK_PACKAGE_NAME "infinity") -if(NOT DEFINED CPACK_PACKAGE_VERSION) +# dpkg requires version to be starting with number +if(DEFINED CPACK_PACKAGE_VERSION) + string(REGEX REPLACE "^[^0-9]+" "" CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}") + string(REPLACE "-" "." CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}") +endif() +if(NOT DEFINED CPACK_PACKAGE_VERSION OR CPACK_PACKAGE_VERSION STREQUAL "") set(CPACK_PACKAGE_VERSION "0.2.1") endif() set(CPACK_PACKAGE_RELEASE 1)