]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: allow to call DEAL_II_QUERY_GIT_INFORMATION from user projects
authorMatthias Maier <matthias.maier@iwr.uni-heidelberg.de>
Wed, 21 Jan 2015 17:48:47 +0000 (18:48 +0100)
committerMatthias Maier <tamiko@43-1.org>
Fri, 23 Jan 2015 14:00:45 +0000 (15:00 +0100)
This commit enables to use the DEAL_II_QUERY_GIT_INFORMATION macro from
within user projects. In this case the variable prefix "DEAL_II_" is
ommited

cmake/config/CMakeLists.txt
cmake/macros/macro_deal_ii_query_git_information.cmake
doc/news/changes.h

index 621a79b79931102f77f5ff521fc281ffea2b20d4..84a7aedafdc383b4c23653c6e22a14d796fbd843 100644 (file)
@@ -42,16 +42,16 @@ CONFIGURE_FILE( # for binary dir:
 #                                                                      #
 ########################################################################
 
-FILE(COPY # for binary dir:
+SET(_macros
   ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake
   ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_invoke_autopilot.cmake
   ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_setup_target.cmake
+  ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_query_git_information.cmake
+  )
+FILE(COPY ${_macros}
   DESTINATION ${CMAKE_BINARY_DIR}/${DEAL_II_CMAKE_MACROS_RELDIR}
   )
-INSTALL(FILES # for installation:
-  ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_initialize_cached_variables.cmake
-  ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_invoke_autopilot.cmake
-  ${CMAKE_SOURCE_DIR}/cmake/macros/macro_deal_ii_setup_target.cmake
+INSTALL(FILES ${_macros}
   DESTINATION ${DEAL_II_CMAKE_MACROS_RELDIR}
   COMPONENT library
   )
index 6ca84c01f20c9fb929a0c4263d188ef86933fd36..aa536b9c64fd89ced9cd2662b154d6251cad78c5 100644 (file)
 # short and long revision. If ${CMAKE_SOURCE_DIR} is the root of a git
 # repository the following variables will be populated:
 #
+#       GIT_BRANCH
+#       GIT_REVISION
+#       GIT_SHORTREV
+#
+# If this macro is called within the deal.II build system the variables are
+# prefixed with DEAL_II_:
+#
 #       DEAL_II_GIT_BRANCH
 #       DEAL_II_GIT_REVISION
 #       DEAL_II_GIT_SHORTREV
@@ -33,6 +40,18 @@ MACRO(DEAL_II_QUERY_GIT_INFORMATION)
 
   MESSAGE(STATUS "Query git repository information.")
 
+  #
+  # If DEAL_II_BASE_NAME is defined and DEAL_II_PROJECT_CONFIG_INCLUDED was
+  # not set, we assume that we are called from within the deal.II build
+  # system. In this case we prepend all variables by "DEAL_II_"
+  #
+  IF( DEFINED DEAL_II_BASE_NAME AND
+      NOT DEFINED DEAL_II_PROJECT_CONFIG_INCLUDED )
+    SET(_prefix "DEAL_II_")
+  ELSE()
+    SET(_prefix "")
+  ENDIF()
+
   FIND_PACKAGE(Git)
 
   #
@@ -70,9 +89,9 @@ MACRO(DEAL_II_QUERY_GIT_INFORMATION)
        )
     IF(${_result} EQUAL 0)
       STRING(REGEX REPLACE "^\"([^ ]+) ([^ ]+)\"$"
-        "\\1" DEAL_II_GIT_REVISION "${_info}")
+        "\\1" ${_prefix}GIT_REVISION "${_info}")
       STRING(REGEX REPLACE "^\"([^ ]+) ([^ ]+)\"$"
-        "\\2" DEAL_II_GIT_SHORTREV "${_info}")
+        "\\2" ${_prefix}GIT_SHORTREV "${_info}")
     ENDIF()
 
     #
@@ -87,7 +106,7 @@ MACRO(DEAL_II_QUERY_GIT_INFORMATION)
        OUTPUT_STRIP_TRAILING_WHITESPACE
        )
     IF(${_result} EQUAL 0)
-      STRING(REGEX REPLACE "refs/heads/" "" DEAL_II_GIT_BRANCH "${_branch}")
+      STRING(REGEX REPLACE "refs/heads/" "" ${_prefix}GIT_BRANCH "${_branch}")
     ENDIF()
   ENDIF()
 
index 47b6ba62e4d0e46eed38d5312e097024783733e5..93e08ccb00f0799ff9cbc139cc3f94c8eeb70d75 100644 (file)
@@ -254,6 +254,13 @@ inconvenience this causes.
 <h3>Specific improvements</h3>
 
 <ol>
+  <li> New: A new macro <code>DEAL_II_QUERY_GIT_INFORMATION</code> is
+  provided to query user projects for git repository information simmilarly
+  to those exported by deal.II.
+  <br>
+  (Matthias Maier, 2015/01/21)
+  </li>
+
   <li> Fixed: FEFaceValues and FESubfaceValues did not fill the
   jacobians and inverse jacobians if requested via the update flags.
   This is now fixed.

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.