]> git.treefish.org Git - cmake-modules/cmake-getgitversion.git/commitdiff
formatting
authorAlexander Schmidt <alex@treefish.org>
Fri, 23 Oct 2015 21:48:13 +0000 (23:48 +0200)
committerAlexander Schmidt <alex@treefish.org>
Fri, 23 Oct 2015 21:48:13 +0000 (23:48 +0200)
GetGitVersion.cmake

index e673152caeb34c00cda2b38fbe6403efbff162c6..202fbf3ed80f6015793a7324677c1aede4e22ffe 100644 (file)
@@ -1,4 +1,4 @@
-# __________________________________________________________________________ __ _
+# __________________________________________________________________________________ __ _
 # get_git_version:
 # Obtain version string from git tags via git_describe and parse result into
 # convenient version variables.
 # <cptiglo@treefish.org> wrote this file.  As long as you retain this notice
 # you can do whatever you want with this stuff. If we meet some day, and you
 # think this stuff is worth it, you can buy me a beer in return.
-# __________________________________________________________________________ __ _
+# __________________________________________________________________________________ __ _
 
 function(get_git_version _gitversionprefix)
     include(GetGitRevisionDescription)
     git_describe(GIT_DESCRIPTION ${ARGN})
 
-    string(REGEX REPLACE "^[^0-9]*([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GIT_DESCRIPTION}")
-    string(REGEX REPLACE "^[^0-9]*[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GIT_DESCRIPTION}")
-    string(REGEX REPLACE "^[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GIT_DESCRIPTION}")
-    string(REGEX REPLACE "^[^0-9]*[0-9]+\\.[0-9]+\\.[0-9]+-(.*)" "\\1" VERSION_EXTRA "${GIT_DESCRIPTION}")
-    string(REGEX REPLACE "([^-]*-g)" "r\\1" VERSION_EXTRA "${VERSION_EXTRA}")
-    string(REGEX REPLACE "-" "." VERSION_EXTRA "${VERSION_EXTRA}")
+    string(REGEX REPLACE
+           "^[^0-9]*([0-9]+)\\..*" "\\1" VERSION_MAJOR "${GIT_DESCRIPTION}")
+    string(REGEX REPLACE
+           "^[^0-9]*[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${GIT_DESCRIPTION}")
+    string(REGEX REPLACE
+           "^[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" VERSION_PATCH "${GIT_DESCRIPTION}")
+    string(REGEX REPLACE
+           "^[^0-9]*[0-9]+\\.[0-9]+\\.[0-9]+-(.*)" "\\1" VERSION_EXTRA "${GIT_DESCRIPTION}")
+    string(REGEX REPLACE
+           "([^-]*-g)" "r\\1" VERSION_EXTRA "${VERSION_EXTRA}")
+    string(REGEX REPLACE
+           "-" "." VERSION_EXTRA "${VERSION_EXTRA}")
 
     set(${_gitversionprefix}_MAJOR "${VERSION_MAJOR}" PARENT_SCOPE)
     set(${_gitversionprefix}_MINOR "${VERSION_MINOR}" PARENT_SCOPE)