cmake: Allow semver style EXTRAVERSION

cmake: Allow semver style EXTRAVERSION

Semver versions are commonly in the form X.X.X-a.1, X.X.X-beta.2, etc.
However, currently EXTRAVERSION cannot include ".". This change allows it.

Signed-off-by: Nick Brook <nrbrook@gmail.com>
This commit is contained in:
Nick Brook 2025-01-17 12:32:56 +00:00 committed by Benjamin Cabé
commit 0d6b3422c9
2 changed files with 14 additions and 14 deletions

View file

@ -63,7 +63,7 @@ foreach(type file IN ZIP_LISTS VERSION_TYPE VERSION_FILE)
string(REGEX MATCH "VERSION_TWEAK = ([0-9]*)" _ ${ver})
set(${type}_VERSION_TWEAK ${CMAKE_MATCH_1})
string(REGEX MATCH "EXTRAVERSION = ([a-z0-9]*)" _ ${ver})
string(REGEX MATCH "EXTRAVERSION = ([a-z0-9\.]*)" _ ${ver})
set(${type}_VERSION_EXTRA ${CMAKE_MATCH_1})
# Validate all version fields fit in a single byte

View file

@ -39,19 +39,19 @@ field to a single byte (note that there may be further restrictions depending up
is used for, e.g. bootloaders might only support some of these fields or might place limits on the
maximum values of fields):
+---------------+----------------------------------------+
+---------------+-------------------------------------------+
| Field | Data type |
+---------------+----------------------------------------+
+---------------+-------------------------------------------+
| VERSION_MAJOR | Numerical (0-255) |
+---------------+----------------------------------------+
+---------------+-------------------------------------------+
| VERSION_MINOR | Numerical (0-255) |
+---------------+----------------------------------------+
+---------------+-------------------------------------------+
| PATCHLEVEL | Numerical (0-255) |
+---------------+----------------------------------------+
+---------------+-------------------------------------------+
| VERSION_TWEAK | Numerical (0-255) |
+---------------+----------------------------------------+
| EXTRAVERSION | Alphanumerical (Lowercase a-z and 0-9) |
+---------------+----------------------------------------+
+---------------+-------------------------------------------+
| EXTRAVERSION | Alphanumerical (Lowercase a-z and 0-9, .) |
+---------------+-------------------------------------------+
When an application is configured using CMake, the version file will be automatically processed,
and will be checked automatically each time the version is changed, so CMake does not need to be