]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add an optional argument to DEAL_II_QUERY_GIT_INFORMATION macro
authorDenis Davydov <davydden@gmail.com>
Mon, 22 May 2017 10:14:36 +0000 (12:14 +0200)
committerDenis Davydov <davydden@gmail.com>
Mon, 22 May 2017 13:45:37 +0000 (15:45 +0200)
cmake/macros/macro_deal_ii_query_git_information.cmake
cmake/setup_write_config.cmake

index 566143c8dfcb363f65eff780031c2969281cf6c1..32354ac21101b936cb68e67c18021dc06e4df73c 100644 (file)
@@ -19,6 +19,7 @@
 #
 # Usage:
 #       DEAL_II_QUERY_GIT_INFORMATION()
+#       DEAL_II_QUERY_GIT_INFORMATION("CUSTOM_PREFIX")
 #
 # This will try to gather information about current branch, as well as
 # short and long revision. If ${CMAKE_SOURCE_DIR} is the root of a git
 #       GIT_SHORTREV
 #       GIT_TAG
 #
-# If this macro is called within the deal.II build system the variables are
-# prefixed with DEAL_II_:
+# The macro can be called with an optional PREFIX argument to prefix the
+# variables:
 #
-#       DEAL_II_GIT_BRANCH
-#       DEAL_II_GIT_REVISION
-#       DEAL_II_GIT_SHORTREV
-#       DEAL_II_GIT_TAG
+#       PREFIX_GIT_BRANCH
+#       PREFIX_GIT_REVISION
+#       PREFIX_GIT_SHORTREV
+#       PREFIX_GIT_TAG
 #
 
 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 "")
+  # Set prefix.
+  SET(_prefix "")
+  IF(NOT "${ARGN}" STREQUAL "")
+    SET(_prefix "${ARGN}_")
   ENDIF()
 
   FIND_PACKAGE(Git)
index 96801beae21cf9918cfebfe9e7c05a19f6196764..daafa3e18b129fa1ec63150e72860eb3b0d777f2 100644 (file)
@@ -20,7 +20,7 @@
 #                                                                      #
 ########################################################################
 
-DEAL_II_QUERY_GIT_INFORMATION()
+DEAL_II_QUERY_GIT_INFORMATION("DEAL_II")
 
 FILE(WRITE ${CMAKE_BINARY_DIR}/revision.log
 "###

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.