diff --git a/api/python/backend/versioning.py b/api/python/backend/versioning.py index 6aca3ec06b..833b4cc6d2 100644 --- a/api/python/backend/versioning.py +++ b/api/python/backend/versioning.py @@ -59,6 +59,9 @@ def format_version(self, version: str, fmt: str, is_dev: bool = False): if branch is not None and branch.startswith("release/"): _, version = branch.split("release/") + major, minor, patch = version.split('.') + if patch == 'x': + return f"{major}.{minor}" return version parts = version.split('-') diff --git a/cmake/LIEFGit.cmake b/cmake/LIEFGit.cmake index dfc6adc3db..0295f7cf7d 100644 --- a/cmake/LIEFGit.cmake +++ b/cmake/LIEFGit.cmake @@ -54,11 +54,15 @@ else() endif() message(STATUS "Current branch: ${LIEF_GIT_BRANCH}") - if (VERSION_STRING) + list(LENGTH VERSION_STRING VERSION_STRING_LEN) list(GET VERSION_STRING 0 LIEF_VERSION_MAJOR) list(GET VERSION_STRING 1 LIEF_VERSION_MINOR) - list(GET VERSION_STRING 2 LIEF_VERSION_PATCH) + if (VERSION_STRING_LEN GREATER 2) + list(GET VERSION_STRING 2 LIEF_VERSION_PATCH) + else() + set(LIEF_VERSION_PATCH 0) + endif() if (NOT ${LIEF_IS_TAGGED}) if(LIEF_GIT_BRANCH MATCHES "^release[-/]")