From 52981a2f09e31dd979b67b2303872d1e70c06097 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Mon, 22 May 2017 12:14:36 +0200 Subject: [PATCH] add an optional argument to DEAL_II_QUERY_GIT_INFORMATION macro --- .../macro_deal_ii_query_git_information.cmake | 27 ++++++++----------- cmake/setup_write_config.cmake | 2 +- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/cmake/macros/macro_deal_ii_query_git_information.cmake b/cmake/macros/macro_deal_ii_query_git_information.cmake index 566143c8df..32354ac211 100644 --- a/cmake/macros/macro_deal_ii_query_git_information.cmake +++ b/cmake/macros/macro_deal_ii_query_git_information.cmake @@ -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 @@ -29,29 +30,23 @@ # 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) diff --git a/cmake/setup_write_config.cmake b/cmake/setup_write_config.cmake index 96801beae2..daafa3e18b 100644 --- a/cmake/setup_write_config.cmake +++ b/cmake/setup_write_config.cmake @@ -20,7 +20,7 @@ # # ######################################################################## -DEAL_II_QUERY_GIT_INFORMATION() +DEAL_II_QUERY_GIT_INFORMATION("DEAL_II") FILE(WRITE ${CMAKE_BINARY_DIR}/revision.log "### -- 2.39.5