Skip to content

Commit bc4f4bb

Browse files
ChristianTackeGSIdennisklein
authored andcommitted
cmake: Drop Generate_Version_Info
1 parent 2562cdb commit bc4f4bb

8 files changed

Lines changed: 10 additions & 94 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3232
flexible local code by users.
3333
* Replace with a local template, `configure_file`, and `execute_process()`
3434
* In your template consider using `source @FairRoot_BINDIR/FairRootConfig.sh`
35+
* Dropped `Generate_Version_Info`
36+
* If you just need to generate some files with your version number in it,
37+
use the standard `configure_file` CMake command.
38+
* Alternatively consider creating a proper CMake Package with
39+
`configure_package_config_file()`, and `write_basic_package_version_file()`.
3540
* Renamed our `ROOT_GENERATE_DICTIONARY` to `FAIRROOT_GENERATE_DICTIONARY`.
3641
(It's not used in many places anyway, it seems.)
3742
* The following files have been deleted. As far as we know they were not used anywhere:

CMakeLists.txt

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,6 @@ if( yaml-cpp_FOUND
234234
)
235235
endif()
236236

237-
configure_file(${CMAKE_SOURCE_DIR}/cmake/private/FairRootConfigVersion.cmake.in "${CMAKE_BINARY_DIR}/FairRootConfigVersion.cmake" @ONLY)
238-
239-
# Load the macro to generate the needed version info at compile time
240-
Generate_Version_Info()
241-
242237
# Set some useful variables
243238
SetBasicVariables()
244239

@@ -302,9 +297,6 @@ install(FILES ${CMAKE_BINARY_DIR}/config.sh_install
302297
install(FILES ${CMAKE_BINARY_DIR}/check_system.sh
303298
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
304299
)
305-
install(FILES ${CMAKE_BINARY_DIR}/FairVersion.h
306-
DESTINATION include
307-
)
308300
install(FILES ${CMAKE_BINARY_DIR}/config.csh_install
309301
DESTINATION ${CMAKE_INSTALL_BINDIR}
310302
RENAME FairRootConfig.csh
@@ -313,18 +305,6 @@ install(FILES ${CMAKE_BINARY_DIR}/check_system.csh
313305
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
314306
)
315307

316-
find_package(Git)
317-
set (Git_VERSION ${GIT_VERSION_STRING})
318-
string(REPLACE "git" " " Git_ROOT ${GIT_EXECUTABLE} )
319-
If(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
320-
Execute_Process(COMMAND ${GIT_EXECUTABLE} describe --tags
321-
OUTPUT_VARIABLE PROJECT_GIT_VERSION
322-
OUTPUT_STRIP_TRAILING_WHITESPACE
323-
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
324-
)
325-
Else()
326-
set(PROJECT_GIT_VERSION "v${PROJECT_VERSION}")
327-
EndIf()
328308
Configure_File(${CMAKE_SOURCE_DIR}/cmake/scripts/fairroot-config.in ${CMAKE_BINARY_DIR}/fairroot-config @ONLY)
329309

330310
install(PROGRAMS ${CMAKE_BINARY_DIR}/fairroot-config

cmake/modules/FairMacros.cmake

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -233,30 +233,6 @@ ENDMACRO(REMOVE_FROM_LIST)
233233
################################################################################
234234

235235

236-
Macro (Generate_Version_Info)
237-
if(FairRoot_FOUND)
238-
239-
Add_Custom_Target(svnheader ALL)
240-
241-
Add_Custom_Command(TARGET svnheader
242-
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${PROJECT_SOURCE_DIR}
243-
-DBINARY_DIR=${CMAKE_BINARY_DIR}
244-
-DINCLUDE_OUTPUT_DIRECTORY=${INCLUDE_OUTPUT_DIRECTORY}
245-
-DFAIRROOT=${FAIRROOT_CMAKEMOD_DIR}
246-
-P ${FAIRROOT_CMAKEMOD_DIR}/modules/GenerateVersionInfo.cmake
247-
)
248-
else()
249-
Add_Custom_Target(svnheader ALL)
250-
Add_Custom_Command(TARGET svnheader
251-
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR}
252-
-DBINARY_DIR=${CMAKE_BINARY_DIR}
253-
-DINCLUDE_OUTPUT_DIRECTORY=${INCLUDE_OUTPUT_DIRECTORY}
254-
-P ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateVersionInfo.cmake
255-
)
256-
endif()
257-
EndMacro (Generate_Version_Info)
258-
################################################################################
259-
260236
Macro (SetBasicVariables)
261237
if(FairRoot_FOUND)
262238
if(TARGET fmt::fmt)

cmake/modules/GenerateVersionInfo.cmake

Lines changed: 0 additions & 39 deletions
This file was deleted.

cmake/private/FairRootConfigVersion.cmake.in

Lines changed: 0 additions & 3 deletions
This file was deleted.

cmake/scripts/FairVersion.h.tmp

Lines changed: 0 additions & 5 deletions
This file was deleted.

fairroot/tools/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
set(target Tools)
1010

11+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FairVersion.h.in ${CMAKE_BINARY_DIR}/FairVersion.h @ONLY)
12+
list(APPEND extra_headers
13+
${CMAKE_BINARY_DIR}/FairVersion.h)
14+
1115
set(sources
1216
FairLogger.cxx
1317
FairMonitor.cxx
@@ -46,4 +50,4 @@ fairroot_target_root_dictionary(${target}
4650
)
4751

4852
fairroot_install_exported(TARGETS ${target})
49-
install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
53+
install(FILES ${headers} ${extra_headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
#ifndef FAIRROOT_VERSION
22
#define FAIRROOT_VERSION "@PROJECT_VERSION@"
3-
#define FAIRROOT_GIT_DATE "Sun Jan 1 00:00:00 0"
43
#endif
5-

0 commit comments

Comments
 (0)