From 0fa3e9a37b37d2ab200a910ff2a5736ca8c57a1b Mon Sep 17 00:00:00 2001 From: scribam Date: Fri, 17 May 2024 18:06:40 +0200 Subject: [PATCH] cmake: better version conversion for uwp --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e4f20ca47..8c620e8cb3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,10 +104,11 @@ if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") string(REGEX REPLACE "[Vv]" "" MS_VERSION ${GIT_VERSION}) string(REPLACE "-" "." MS_VERSION ${MS_VERSION}) string(REGEX REPLACE "\.g[0-9a-f]+" "" MS_VERSION ${MS_VERSION}) - string(REGEX MATCH "[0-9]+\.[0-9]+\.[0-9]+" VERSION_3PARTS ${MS_VERSION}) - if(VERSION_3PARTS STREQUAL "") + string(REGEX MATCHALL "[0-9]+" VERSION_PARTS ${MS_VERSION}) + list(LENGTH VERSION_PARTS VERSION_PARTS_LENGTH) + if(VERSION_PARTS_LENGTH EQUAL 2) string(APPEND MS_VERSION ".0.0") - else() + elseif(VERSION_PARTS_LENGTH EQUAL 3) string(APPEND MS_VERSION ".0") endif() endif()