Skip to content

Commit

Permalink
cmake: better version conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
scribam committed May 16, 2024
1 parent 134b336 commit 7c25dac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,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})
string(REGEX MATCH "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" VERSION_4PARTS ${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")
elseif(VERSION_4PARTS STREQUAL "")
elseif(VERSION_PARTS_LENGTH EQUAL 3)
string(APPEND MS_VERSION ".0")
endif()
endif()
Expand Down

0 comments on commit 7c25dac

Please sign in to comment.