From 816177f9be66f428fe86797eb46238118b208528 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 3 Jul 2023 11:27:00 -0500 Subject: [PATCH] CMake: record git information in a separate configuration file --- cmake/config/CMakeLists.txt | 11 +++++++++++ cmake/config/Config.cmake.in | 8 ++------ cmake/config/ConfigGit.cmake.in | 25 +++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 cmake/config/ConfigGit.cmake.in diff --git a/cmake/config/CMakeLists.txt b/cmake/config/CMakeLists.txt index f66e213095..bb0da8f0b6 100644 --- a/cmake/config/CMakeLists.txt +++ b/cmake/config/CMakeLists.txt @@ -98,6 +98,11 @@ configure_file( ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake @ONLY ) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/ConfigGit.cmake.in + ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigGit.cmake + @ONLY + ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ConfigVersion.cmake.in ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake @@ -115,6 +120,11 @@ configure_file( ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake @ONLY ) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/ConfigGit.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigGit.cmake + @ONLY + ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/ConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake @@ -122,6 +132,7 @@ configure_file( ) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigGit.cmake ${CMAKE_CURRENT_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_NAME}ConfigVersion.cmake DESTINATION ${DEAL_II_PROJECT_CONFIG_RELDIR} COMPONENT library diff --git a/cmake/config/Config.cmake.in b/cmake/config/Config.cmake.in index 2c1cc2c3d3..72b2467f01 100644 --- a/cmake/config/Config.cmake.in +++ b/cmake/config/Config.cmake.in @@ -34,11 +34,6 @@ set(DEAL_II_VERSION_MINOR "@DEAL_II_VERSION_MINOR@") set(DEAL_II_VERSION_SUBMINOR "@DEAL_II_VERSION_SUBMINOR@") set(DEAL_II_VERSION "@DEAL_II_VERSION@") -set(DEAL_II_GIT_BRANCH "@DEAL_II_GIT_BRANCH@") -set(DEAL_II_GIT_REVISION "@DEAL_II_GIT_REVISION@") -set(DEAL_II_GIT_SHORTREV "@DEAL_II_GIT_SHORTREV@") -set(DEAL_II_GIT_TAG "@DEAL_II_GIT_TAG@") - set(DEAL_II_PROJECT_CONFIG_NAME "@DEAL_II_PROJECT_CONFIG_NAME@") set(DEAL_II_BUILD_TYPE "@CMAKE_BUILD_TYPE@") @@ -140,9 +135,10 @@ set(DEAL_II_MPIEXEC_PREFLAGS "@MPIEXEC_PREFLAGS@") set(DEAL_II_MPIEXEC_POSTFLAGS "@MPIEXEC_POSTFLAGS@") # -# Information about library targets and feature configuration +# Information about git revision, library targets and feature configuration # +set(DEAL_II_GIT_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Git.cmake") set(DEAL_II_TARGET_CONFIG "${DEAL_II_PATH}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake") # diff --git a/cmake/config/ConfigGit.cmake.in b/cmake/config/ConfigGit.cmake.in new file mode 100644 index 0000000000..c3ba66e2a9 --- /dev/null +++ b/cmake/config/ConfigGit.cmake.in @@ -0,0 +1,25 @@ +## --------------------------------------------------------------------- +## +## Copyright (C) 2023 - 2023 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE.md at +## the top level directory of deal.II. +## +## --------------------------------------------------------------------- + + +# +# Git information +# + +set(DEAL_II_GIT_BRANCH "@DEAL_II_GIT_BRANCH@") +set(DEAL_II_GIT_REVISION "@DEAL_II_GIT_REVISION@") +set(DEAL_II_GIT_SHORTREV "@DEAL_II_GIT_SHORTREV@") +set(DEAL_II_GIT_TAG "@DEAL_II_GIT_TAG@") + -- 2.39.5