diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2016-03-23 10:06:12 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2016-03-23 10:06:12 +0000 |
commit | 04f670ac098e07fe1cf5770d0d77e77f3b756a6b (patch) | |
tree | a26cb7ca4da13bbb2312a92c078df2e338d44145 /libs/libevent/docs/cmake/VersionViaGit.cmake | |
parent | 7e8aa70c724e6b72817cba090b7b178fd7f86341 (diff) |
libevent moved to libs folder
telegram not compiled yet
git-svn-id: http://svn.miranda-ng.org/main/trunk@16524 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'libs/libevent/docs/cmake/VersionViaGit.cmake')
-rw-r--r-- | libs/libevent/docs/cmake/VersionViaGit.cmake | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/libs/libevent/docs/cmake/VersionViaGit.cmake b/libs/libevent/docs/cmake/VersionViaGit.cmake new file mode 100644 index 0000000000..f183a64713 --- /dev/null +++ b/libs/libevent/docs/cmake/VersionViaGit.cmake @@ -0,0 +1,53 @@ +# This module defines the following variables utilizing +# git to determine the parent tag. And if found the macro +# will attempt to parse them in the github tag fomat +# +# Usful for auto-versionin in ou CMakeLists +# +# EVENT_GIT___VERSION_FOUND - Version variables foud +# EVENT_GIT___VERSION_MAJOR - Major version. +# EVENT_GIT___VERSION_MINOR - Minor version +# EVENT_GIT___VERSION_STAGE - Stage version +# +# Example usage: +# +# event_fuzzy_version_from_git() +# if (EVENT_GIT___VERSION_FOUND) +# message("Libvent major=${EVENT_GIT___VERSION_MAJOR}") +# message(" minor=${EVENT_GIT___VERSION_MINOR}") +# message(" patch=${EVENT_GIT___VERSION_PATCH}") +# message(" stage=${EVENT_GIT___VERSION_STAGE}") +# endif() + +include(FindGit) + +macro(event_fuzzy_version_from_git) + set(EVENT_GIT___VERSION_FOUND FALSE) + + # set our defaults. + set(EVENT_GIT___VERSION_MAJOR 2) + set(EVENT_GIT___VERSION_MINOR 1) + set(EVENT_GIT___VERSION_PATCH 5) + set(EVENT_GIT___VERSION_STAGE "beta") + + find_package(Git) + + if (GIT_FOUND) + execute_process( + COMMAND + ${GIT_EXECUTABLE} describe --abbrev=0 + WORKING_DIRECTORY + ${PROJECT_SOURCE_DIR} + RESULT_VARIABLE + GITRET + OUTPUT_VARIABLE + GITVERSION) + + if (GITRET EQUAL 0) + string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)" "\\1" EVENT_GIT___VERSION_MAJOR ${GITVERSION}) + string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)" "\\2" EVENT_GIT___VERSION_MINOR ${GITVERSION}) + string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-(.*)" "\\3" EVENT_GIT___VERSION_PATCH ${GITVERSION}) + string(REGEX REPLACE "^release-([0-9]+)\\.([0-9]+)\\.([0-9]+)-([aA-zZ]+)" "\\4" EVENT_GIT___VERSION_STAGE ${GITVERSION}) + endif() + endif() +endmacro() |