]> https://gitweb.dealii.org/ - dealii.git/commitdiff
cmake: query for latest tag
authorDenis Davydov <davydden@gmail.com>
Mon, 22 May 2017 09:54:24 +0000 (11:54 +0200)
committerDenis Davydov <davydden@gmail.com>
Mon, 22 May 2017 09:54:24 +0000 (11:54 +0200)
cmake/macros/macro_deal_ii_query_git_information.cmake

index aa536b9c64fd89ced9cd2662b154d6251cad78c5..566143c8dfcb363f65eff780031c2969281cf6c1 100644 (file)
@@ -27,6 +27,7 @@
 #       GIT_BRANCH
 #       GIT_REVISION
 #       GIT_SHORTREV
+#       GIT_TAG
 #
 # If this macro is called within the deal.II build system the variables are
 # prefixed with DEAL_II_:
@@ -34,6 +35,7 @@
 #       DEAL_II_GIT_BRANCH
 #       DEAL_II_GIT_REVISION
 #       DEAL_II_GIT_SHORTREV
+#       DEAL_II_GIT_TAG
 #
 
 MACRO(DEAL_II_QUERY_GIT_INFORMATION)
@@ -108,6 +110,30 @@ MACRO(DEAL_II_QUERY_GIT_INFORMATION)
     IF(${_result} EQUAL 0)
       STRING(REGEX REPLACE "refs/heads/" "" ${_prefix}GIT_BRANCH "${_branch}")
     ENDIF()
+
+    #
+    # Query for tag:
+    #
+
+    EXECUTE_PROCESS(
+       COMMAND ${GIT_EXECUTABLE} rev-list --tags --max-count=1
+       WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+       OUTPUT_VARIABLE _tag
+       RESULT_VARIABLE _result
+       OUTPUT_STRIP_TRAILING_WHITESPACE
+       )
+
+    EXECUTE_PROCESS(
+       COMMAND ${GIT_EXECUTABLE} describe --tags ${_tag}
+       WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+       OUTPUT_VARIABLE _tag
+       RESULT_VARIABLE _result
+       OUTPUT_STRIP_TRAILING_WHITESPACE
+       )
+    IF(${_result} EQUAL 0)
+      SET(${_prefix}GIT_TAG ${_tag})
+    ENDIF()
+
   ENDIF()
 
 ENDMACRO()

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.