Commit 8d93bca2 authored by Andreas Schuh's avatar Andreas Schuh

Minor CMake coding style change of version_numbers function.

parent 0d9486f9
......@@ -2,33 +2,33 @@
# ----------------------------------------------------------------------------
## Extract version numbers from version string.
function (version_numbers VERSION MAJOR MINOR PATCH)
if (VERSION MATCHES "([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(rc[1-9][0-9]*|[a-z]+)?")
function (version_numbers version major minor patch)
if (version MATCHES "([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(rc[1-9][0-9]*|[a-z]+)?")
if (CMAKE_MATCH_1)
set (VERSION_MAJOR ${CMAKE_MATCH_1})
set (_major ${CMAKE_MATCH_1})
else ()
set (VERSION_MAJOR 0)
set (_major 0)
endif ()
if (CMAKE_MATCH_2)
set (VERSION_MINOR ${CMAKE_MATCH_2})
string (REGEX REPLACE "^\\." "" VERSION_MINOR "${VERSION_MINOR}")
set (_minor ${CMAKE_MATCH_2})
string (REGEX REPLACE "^\\." "" _minor "${_minor}")
else ()
set (VERSION_MINOR 0)
set (_minor 0)
endif ()
if (CMAKE_MATCH_3)
set (VERSION_PATCH ${CMAKE_MATCH_3})
string (REGEX REPLACE "^\\." "" VERSION_PATCH "${VERSION_PATCH}")
set (_patch ${CMAKE_MATCH_3})
string (REGEX REPLACE "^\\." "" _patch "${_patch}")
else ()
set (VERSION_PATCH 0)
set (_patch 0)
endif ()
else ()
set (VERSION_MAJOR 0)
set (VERSION_MINOR 0)
set (VERSION_PATCH 0)
set (_major 0)
set (_minor 0)
set (_patch 0)
endif ()
set ("${MAJOR}" "${VERSION_MAJOR}" PARENT_SCOPE)
set ("${MINOR}" "${VERSION_MINOR}" PARENT_SCOPE)
set ("${PATCH}" "${VERSION_PATCH}" PARENT_SCOPE)
set ("${major}" "${_major}" PARENT_SCOPE)
set ("${minor}" "${_minor}" PARENT_SCOPE)
set ("${patch}" "${_patch}" PARENT_SCOPE)
endfunction ()
# ----------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment