Skip to content

Commit e05679b

Browse files
build: Export Git Version Information
If building a specific git commit, try to export that information. fixes: #1076
1 parent f3bea98 commit e05679b

6 files changed

Lines changed: 18 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3737
use the standard `configure_file` CMake command.
3838
* Alternatively consider creating a proper CMake Package with
3939
`configure_package_config_file()`, and `write_basic_package_version_file()`.
40+
* If you need the "git version", use
41+
[`fair_get_git_version()` from FairCMakeModules](https://fairrootgroup.github.io/FairCMakeModules/latest/module/FairProjectConfig.html#fair-get-git-version)
42+
in addition.
4043
* Renamed our `ROOT_GENERATE_DICTIONARY` to `FAIRROOT_GENERATE_DICTIONARY`.
4144
(It's not used in many places anyway, it seems.)
4245
* The following files have been deleted. As far as we know they were not used anywhere:

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ find_package(FairCMakeModules 0.2 QUIET REQUIRED)
7979
include(FairFindPackage2)
8080
include(FairFormattedOutput)
8181
include(FairSummary)
82+
if(FairCMakeModules_VERSION VERSION_GREATER_EQUAL 1.0.0)
83+
include(FairProjectConfig)
84+
endif()
85+
8286
include(FairRootTargets)
8387
include(FairRootPackage)
8488
include(FairRootSummary)
@@ -87,6 +91,10 @@ include(WriteConfigFile)
8791
include(Dart)
8892
include(CheckCompiler)
8993

94+
if(FairCMakeModules_VERSION VERSION_GREATER_EQUAL 1.0.0)
95+
fair_get_git_version()
96+
endif()
97+
9098
set(LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR}/lib")
9199

92100

cmake/modules/FindFairRoot.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
################################################################################
2-
# Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
2+
# Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
33
# #
44
# This software is distributed under the terms of the #
55
# GNU Lesser General Public Licence (LGPL) version 3, #
@@ -34,6 +34,9 @@ set(FAIRROOTPATH "${FairRoot_PREFIX}")
3434

3535
MESSAGE(STATUS "Setting FairRoot environment:")
3636
message(STATUS " FairRoot Version : ${FairRoot_VERSION}")
37+
if(FairRoot_GIT_VERSION)
38+
message(STATUS " FairRoot Version (Git) : ${FairRoot_GIT_VERSION}")
39+
endif()
3740
message(STATUS " FairRoot CXX Standard : ${FairRoot_CXX_STANDARD}")
3841
message(STATUS " FairRoot prefix : ${FairRoot_PREFIX}")
3942

cmake/private/FairRootConfig.cmake.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
set_and_check(@PROJECT_NAME@_PREFIX "@PACKAGE_CMAKE_INSTALL_PREFIX@")
1212
set(@PROJECT_NAME@_BINDIR "@PACKAGE_CMAKE_INSTALL_FULL_BINDIR@")
13+
set(@PROJECT_NAME@_GIT_VERSION "@PROJECT_GIT_VERSION@")
1314
set(@PROJECT_NAME@_CXX_STANDARD "@CMAKE_CXX_STANDARD@")
1415

1516
check_required_components(@PROJECT_NAME@)

doxygen/doxyfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#---------------------------------------------------------------------------
66
DOXYFILE_ENCODING = UTF-8
77
PROJECT_NAME = @DOXYGEN_PROJECT_NAME@
8-
PROJECT_NUMBER = @PROJECT_VERSION@
8+
PROJECT_NUMBER = @PROJECT_VERSION@ (@PROJECT_GIT_VERSION@)
99
PROJECT_BRIEF =
1010
PROJECT_LOGO =
1111
OUTPUT_DIRECTORY = "@CMAKE_CURRENT_BINARY_DIR@/doc"

fairroot/tools/FairVersion.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#ifndef FAIRROOT_VERSION
22
#define FAIRROOT_VERSION "@PROJECT_VERSION@"
3+
#define FAIRROOT_GIT_VERSION "@PROJECT_GIT_VERSION@"
34
#endif

0 commit comments

Comments
 (0)