mirror of
https://github.com/gflags/gflags.git
synced 2025-04-05 05:25:04 +00:00
Minor CMake coding style change of version_numbers function.
This commit is contained in:
parent
0d9486f9a3
commit
8d93bca20a
1 changed files with 16 additions and 16 deletions
|
@ -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 ()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Reference in a new issue