diff --git a/CMakeLists.txt b/CMakeLists.txt index d2c6fc0a7..928667710 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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()