Skip to content

Commit

Permalink
build: Export Git Version Information
Browse files Browse the repository at this point in the history
If building a specific git commit, try to export that
information.

fixes: FairRootGroup#1076
  • Loading branch information
ChristianTackeGSI committed Mar 29, 2023
1 parent f3bea98 commit e05679b
Showing 6 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -37,6 +37,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
use the standard `configure_file` CMake command.
* Alternatively consider creating a proper CMake Package with
`configure_package_config_file()`, and `write_basic_package_version_file()`.
* If you need the "git version", use
[`fair_get_git_version()` from FairCMakeModules](https://fairrootgroup.github.io/FairCMakeModules/latest/module/FairProjectConfig.html#fair-get-git-version)
in addition.
* Renamed our `ROOT_GENERATE_DICTIONARY` to `FAIRROOT_GENERATE_DICTIONARY`.
(It's not used in many places anyway, it seems.)
* The following files have been deleted. As far as we know they were not used anywhere:
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -79,6 +79,10 @@ find_package(FairCMakeModules 0.2 QUIET REQUIRED)
include(FairFindPackage2)
include(FairFormattedOutput)
include(FairSummary)
if(FairCMakeModules_VERSION VERSION_GREATER_EQUAL 1.0.0)
include(FairProjectConfig)
endif()

include(FairRootTargets)
include(FairRootPackage)
include(FairRootSummary)
@@ -87,6 +91,10 @@ include(WriteConfigFile)
include(Dart)
include(CheckCompiler)

if(FairCMakeModules_VERSION VERSION_GREATER_EQUAL 1.0.0)
fair_get_git_version()
endif()

set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")


5 changes: 4 additions & 1 deletion cmake/modules/FindFairRoot.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
################################################################################
# Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
# #
# This software is distributed under the terms of the #
# GNU Lesser General Public Licence (LGPL) version 3, #
@@ -34,6 +34,9 @@ set(FAIRROOTPATH "${FairRoot_PREFIX}")

MESSAGE(STATUS "Setting FairRoot environment:")
message(STATUS " FairRoot Version : ${FairRoot_VERSION}")
if(FairRoot_GIT_VERSION)
message(STATUS " FairRoot Version (Git) : ${FairRoot_GIT_VERSION}")
endif()
message(STATUS " FairRoot CXX Standard : ${FairRoot_CXX_STANDARD}")
message(STATUS " FairRoot prefix : ${FairRoot_PREFIX}")

1 change: 1 addition & 0 deletions cmake/private/FairRootConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@

set_and_check(@PROJECT_NAME@_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
set(@PROJECT_NAME@_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@")
set(@PROJECT_NAME@_GIT_VERSION "@PROJECT_GIT_VERSION@")
set(@PROJECT_NAME@_CXX_STANDARD "@CMAKE_CXX_STANDARD@")

check_required_components(@PROJECT_NAME@)
2 changes: 1 addition & 1 deletion doxygen/doxyfile.in
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = @DOXYGEN_PROJECT_NAME@
PROJECT_NUMBER = @PROJECT_VERSION@
PROJECT_NUMBER = @PROJECT_VERSION@ (@PROJECT_GIT_VERSION@)
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = "@CMAKE_CURRENT_BINARY_DIR@/doc"
1 change: 1 addition & 0 deletions fairroot/tools/FairVersion.h.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifndef FAIRROOT_VERSION
#define FAIRROOT_VERSION "@PROJECT_VERSION@"
#define FAIRROOT_GIT_VERSION "@PROJECT_GIT_VERSION@"
#endif

0 comments on commit e05679b

Please sign in to comment.