aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2021-08-05 06:08:12 +0200
committerFriedrich W. H. Kossebau <kossebau@kde.org>2021-08-05 06:08:12 +0200
commita0f8e5469f388840d99aa8e8ff6f404cc16a66ad (patch)
treeadcaa25646d5d0edbdf6db45610f055dcbc7fc24 /modules
parent3d946c0ef81874e26743967ec2322e75944d784a (diff)
downloadextra-cmake-modules-a0f8e5469f388840d99aa8e8ff6f404cc16a66ad.tar.gz
extra-cmake-modules-a0f8e5469f388840d99aa8e8ff6f404cc16a66ad.tar.bz2
ecm_setup_version: deal with 0-prefixed version values in PROJECT mode
5c191fa1d2383c69ddc075395e04f84b7679613a already added the same sanity check for the non-PROJECT mode
Diffstat (limited to 'modules')
-rw-r--r--modules/ECMSetupVersion.cmake7
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/ECMSetupVersion.cmake b/modules/ECMSetupVersion.cmake
index f4b2e700..bf9eb7ca 100644
--- a/modules/ECMSetupVersion.cmake
+++ b/modules/ECMSetupVersion.cmake
@@ -132,9 +132,10 @@ function(ecm_setup_version _version)
if(use_project_version)
set(_version "${PROJECT_VERSION}")
- set(_major "${PROJECT_VERSION_MAJOR}")
- set(_minor "${PROJECT_VERSION_MINOR}")
- set(_patch "${PROJECT_VERSION_PATCH}")
+ # drop leading 0 from values to avoid bogus octal values in c/C++ e.g. with 08 or 09
+ string(REGEX REPLACE "^0+" "" _major "${PROJECT_VERSION_MAJOR}")
+ string(REGEX REPLACE "^0+" "" _minor "${PROJECT_VERSION_MINOR}")
+ string(REGEX REPLACE "^0+" "" _patch "${PROJECT_VERSION_PATCH}")
else()
string(REGEX REPLACE "^0*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _major "${_version}")
string(REGEX REPLACE "^[0-9]+\\.0*([0-9]+)\\.[0-9]+.*" "\\1" _minor "${_version}")