aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorChristophe Giboudeaux <christophe@krop.fr>2021-08-05 13:28:48 +0200
committerChristophe Giboudeaux <christophe@krop.fr>2021-08-05 13:28:48 +0200
commited3a19e64b8225f0edb1dacf764eb03ae88fb6d5 (patch)
treefd21a5bded67004d6dabd09de55d1b1597861970 /modules
parentf0790f9103e9df3b5d16f9866b4252ad023ed84d (diff)
downloadextra-cmake-modules-ed3a19e64b8225f0edb1dacf764eb03ae88fb6d5.tar.gz
extra-cmake-modules-ed3a19e64b8225f0edb1dacf764eb03ae88fb6d5.tar.bz2
Simplify the PROJECT_VERSION regex
CMake rejects the project version if it contains anything but dots and numbers, there's no need to try to catch anything else.
Diffstat (limited to 'modules')
-rw-r--r--modules/ECMSetupVersion.cmake6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/ECMSetupVersion.cmake b/modules/ECMSetupVersion.cmake
index 0d950db5..73b71ed1 100644
--- a/modules/ECMSetupVersion.cmake
+++ b/modules/ECMSetupVersion.cmake
@@ -133,9 +133,9 @@ function(ecm_setup_version _version)
if(use_project_version)
set(_version "${PROJECT_VERSION}")
# drop leading 0 from values to avoid bogus octal values in c/C++ e.g. with 08 or 09
- string(REGEX REPLACE "0*([0-9]+).*" "\\1" _major "${PROJECT_VERSION_MAJOR}")
- string(REGEX REPLACE "0*([0-9]+).*" "\\1" _minor "${PROJECT_VERSION_MINOR}")
- string(REGEX REPLACE "0*([0-9]+).*" "\\1" _patch "${PROJECT_VERSION_PATCH}")
+ string(REGEX REPLACE "0*([0-9]+)" "\\1" _major "${PROJECT_VERSION_MAJOR}")
+ string(REGEX REPLACE "0*([0-9]+)" "\\1" _minor "${PROJECT_VERSION_MINOR}")
+ string(REGEX REPLACE "0*([0-9]+)" "\\1" _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}")