mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-14 06:49:35 -04:00
Do not overwrite version from GIT if it is older then defaults
(cherry picked from commit 0344edf62dc49d822315a8d832f17be8d2c43643)
This commit is contained in:
parent
40da44bd9b
commit
3a1f47fd1d
@ -4,7 +4,6 @@
|
|||||||
#
|
#
|
||||||
# Usful for auto-versionin in ou CMakeLists
|
# Usful for auto-versionin in ou CMakeLists
|
||||||
#
|
#
|
||||||
# EVENT_GIT___VERSION_FOUND - Version variables foud
|
|
||||||
# EVENT_GIT___VERSION_MAJOR - Major version.
|
# EVENT_GIT___VERSION_MAJOR - Major version.
|
||||||
# EVENT_GIT___VERSION_MINOR - Minor version
|
# EVENT_GIT___VERSION_MINOR - Minor version
|
||||||
# EVENT_GIT___VERSION_STAGE - Stage version
|
# EVENT_GIT___VERSION_STAGE - Stage version
|
||||||
@ -12,7 +11,6 @@
|
|||||||
# Example usage:
|
# Example usage:
|
||||||
#
|
#
|
||||||
# event_fuzzy_version_from_git()
|
# event_fuzzy_version_from_git()
|
||||||
# if (EVENT_GIT___VERSION_FOUND)
|
|
||||||
# message("Libvent major=${EVENT_GIT___VERSION_MAJOR}")
|
# message("Libvent major=${EVENT_GIT___VERSION_MAJOR}")
|
||||||
# message(" minor=${EVENT_GIT___VERSION_MINOR}")
|
# message(" minor=${EVENT_GIT___VERSION_MINOR}")
|
||||||
# message(" patch=${EVENT_GIT___VERSION_PATCH}")
|
# message(" patch=${EVENT_GIT___VERSION_PATCH}")
|
||||||
@ -22,8 +20,6 @@
|
|||||||
include(FindGit)
|
include(FindGit)
|
||||||
|
|
||||||
macro(event_fuzzy_version_from_git)
|
macro(event_fuzzy_version_from_git)
|
||||||
set(EVENT_GIT___VERSION_FOUND FALSE)
|
|
||||||
|
|
||||||
# set our defaults.
|
# set our defaults.
|
||||||
set(EVENT_GIT___VERSION_MAJOR 2)
|
set(EVENT_GIT___VERSION_MAJOR 2)
|
||||||
set(EVENT_GIT___VERSION_MINOR 1)
|
set(EVENT_GIT___VERSION_MINOR 1)
|
||||||
@ -41,13 +37,25 @@ macro(event_fuzzy_version_from_git)
|
|||||||
RESULT_VARIABLE
|
RESULT_VARIABLE
|
||||||
GITRET
|
GITRET
|
||||||
OUTPUT_VARIABLE
|
OUTPUT_VARIABLE
|
||||||
GITVERSION)
|
GITVERSION
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
if (GITRET EQUAL 0)
|
if (GITRET EQUAL 0)
|
||||||
string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)" "\\1" EVENT_GIT___VERSION_MAJOR ${GITVERSION})
|
string(REGEX REPLACE "[\\._-]" ";" VERSION_LIST "${GITVERSION}")
|
||||||
string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)" "\\2" EVENT_GIT___VERSION_MINOR ${GITVERSION})
|
list(GET VERSION_LIST 1 _MAJOR)
|
||||||
string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)" "\\3" EVENT_GIT___VERSION_PATCH ${GITVERSION})
|
list(GET VERSION_LIST 2 _MINOR)
|
||||||
string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-([aA-zZ]+)" "\\4" EVENT_GIT___VERSION_STAGE ${GITVERSION})
|
list(GET VERSION_LIST 3 _PATCH)
|
||||||
|
list(GET VERSION_LIST 4 _STAGE)
|
||||||
|
|
||||||
|
set(_DEFAULT_VERSION "${EVENT_GIT___VERSION_MAJOR}.${EVENT_GIT___VERSION_MINOR}.${EVENT_GIT___VERSION_PATCH}-${EVENT_GIT___VERSION_STAGE}")
|
||||||
|
set(_GIT_VERSION "${_MAJOR}.${_MINOR}.${_PATCH}-${_STAGE}")
|
||||||
|
|
||||||
|
if (${_DEFAULT_VERSION} VERSION_LESS ${_GIT_VERSION})
|
||||||
|
set(EVENT_GIT___VERSION_MAJOR ${_MAJOR})
|
||||||
|
set(EVENT_GIT___VERSION_MINOR ${_MINOR})
|
||||||
|
set(EVENT_GIT___VERSION_PATCH ${_PATCH})
|
||||||
|
set(EVENT_GIT___VERSION_STAGE ${_STAGE})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user