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 @@ ...@@ -2,33 +2,33 @@
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
## Extract version numbers from version string. ## Extract version numbers from version string.
function (version_numbers VERSION MAJOR MINOR PATCH) function (version_numbers version major minor patch)
if (VERSION MATCHES "([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(rc[1-9][0-9]*|[a-z]+)?") if (version MATCHES "([0-9]+)(\\.[0-9]+)?(\\.[0-9]+)?(rc[1-9][0-9]*|[a-z]+)?")
if (CMAKE_MATCH_1) if (CMAKE_MATCH_1)
set (VERSION_MAJOR ${CMAKE_MATCH_1}) set (_major ${CMAKE_MATCH_1})
else () else ()
set (VERSION_MAJOR 0) set (_major 0)
endif () endif ()
if (CMAKE_MATCH_2) if (CMAKE_MATCH_2)
set (VERSION_MINOR ${CMAKE_MATCH_2}) set (_minor ${CMAKE_MATCH_2})
string (REGEX REPLACE "^\\." "" VERSION_MINOR "${VERSION_MINOR}") string (REGEX REPLACE "^\\." "" _minor "${_minor}")
else () else ()
set (VERSION_MINOR 0) set (_minor 0)
endif () endif ()
if (CMAKE_MATCH_3) if (CMAKE_MATCH_3)
set (VERSION_PATCH ${CMAKE_MATCH_3}) set (_patch ${CMAKE_MATCH_3})
string (REGEX REPLACE "^\\." "" VERSION_PATCH "${VERSION_PATCH}") string (REGEX REPLACE "^\\." "" _patch "${_patch}")
else () else ()
set (VERSION_PATCH 0) set (_patch 0)
endif () endif ()
else () else ()
set (VERSION_MAJOR 0) set (_major 0)
set (VERSION_MINOR 0) set (_minor 0)
set (VERSION_PATCH 0) set (_patch 0)
endif () endif ()
set ("${MAJOR}" "${VERSION_MAJOR}" PARENT_SCOPE) set ("${major}" "${_major}" PARENT_SCOPE)
set ("${MINOR}" "${VERSION_MINOR}" PARENT_SCOPE) set ("${minor}" "${_minor}" PARENT_SCOPE)
set ("${PATCH}" "${VERSION_PATCH}" PARENT_SCOPE) set ("${patch}" "${_patch}" PARENT_SCOPE)
endfunction () 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