summaryrefslogtreecommitdiff
path: root/cmake/GitVersionGen.cmake
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2017-03-21 16:21:49 +0100
committerSander Vrijders <[email protected]>2017-03-21 16:21:49 +0100
commitfef50c3db0e02f0052f1759d508045c44fc4146e (patch)
treefc73859827a5dfebf5022fad37e826d98ba4046f /cmake/GitVersionGen.cmake
parent4b257b249ea91d1ee7e2341c563bac561911e8a6 (diff)
parentd4e80d41197b75d2c351659c7e8d4546270e677d (diff)
downloadouroboros-fef50c3db0e02f0052f1759d508045c44fc4146e.tar.gz
ouroboros-fef50c3db0e02f0052f1759d508045c44fc4146e.zip
Merge branch 'be' of bitbucket.org:ouroboros-rina/ouroboros into be
Diffstat (limited to 'cmake/GitVersionGen.cmake')
-rw-r--r--cmake/GitVersionGen.cmake58
1 files changed, 29 insertions, 29 deletions
diff --git a/cmake/GitVersionGen.cmake b/cmake/GitVersionGen.cmake
index 53ac166d..718ec8a3 100644
--- a/cmake/GitVersionGen.cmake
+++ b/cmake/GitVersionGen.cmake
@@ -1,23 +1,23 @@
-macro(GIT_VERSION_GEN)
+macro(git_version_gen)
-include(FindGit)
-if(NOT GIT_FOUND)
- message(FATAL_ERROR "This is not a git repository")
-endif()
+ include(FindGit)
+ if (NOT GIT_FOUND)
+ message(FATAL_ERROR "This is not a git repository")
+ endif ()
-find_program(SORT "sort")
-mark_as_advanced(SORT)
-if (${SORT} STREQUAL "")
- message(FATAL_ERROR "Cannot find the sort executable")
-endif()
+ find_program(SORT "sort")
+ mark_as_advanced(SORT)
+ if (${SORT} STREQUAL "")
+ message(FATAL_ERROR "Cannot find the sort executable")
+ endif ()
-find_program(TAIL "tail")
-mark_as_advanced(TAIL)
-if (${TAIL} STREQUAL "")
- message(FATAL_ERROR "Cannot find the tail executable")
-endif()
+ find_program(TAIL "tail")
+ mark_as_advanced(TAIL)
+ if (${TAIL} STREQUAL "")
+ message(FATAL_ERROR "Cannot find the tail executable")
+ endif ()
-execute_process(
+ execute_process(
COMMAND ${GIT_EXECUTABLE} tag -l -n0
COMMAND ${SORT} -V
COMMAND ${TAIL} -n 1
@@ -25,19 +25,19 @@ execute_process(
OUTPUT_VARIABLE _git_tag
RESULT_VARIABLE _git_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
-if(NOT ${_git_result} EQUAL 0)
- message(FATAL_ERROR "Cannot fetch repository tag")
-endif()
-message(STATUS "Repository tag is: ${_git_tag}")
+ if (NOT ${_git_result} EQUAL 0)
+ message(FATAL_ERROR "Cannot fetch repository tag")
+ endif ()
+ message(STATUS "Repository tag is: ${_git_tag}")
-string(REGEX REPLACE
- "[^0-9]*([0-9]+)\\.[0-9]+.*" "\\1"
- _version_major "${_git_tag}")
-string(REGEX REPLACE
- "[^0-9]*[0-9]+\\.([0-9]+).*" "\\1"
- _version_minor "${_git_tag}")
+ string(REGEX REPLACE
+ "[^0-9]*([0-9]+)\\.[0-9]+.*" "\\1"
+ _version_major "${_git_tag}")
+ string(REGEX REPLACE
+ "[^0-9]*[0-9]+\\.([0-9]+).*" "\\1"
+ _version_minor "${_git_tag}")
-set(PACKAGE_VERSION_MAJOR "${_version_major}")
-set(PACKAGE_VERSION_MINOR "${_version_minor}")
+ set(PACKAGE_VERSION_MAJOR "${_version_major}")
+ set(PACKAGE_VERSION_MINOR "${_version_minor}")
-endmacro(GIT_VERSION_GEN)
+endmacro(git_version_gen)