Skip to content

Commit

Permalink
cmake: Drop Generate_Version_Info
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianTackeGSI authored and dennisklein committed Mar 24, 2023
1 parent 2562cdb commit bc4f4bb
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 94 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
flexible local code by users.
* Replace with a local template, `configure_file`, and `execute_process()`
* In your template consider using `source @FairRoot_BINDIR/FairRootConfig.sh`
* Dropped `Generate_Version_Info`
* If you just need to generate some files with your version number in it,
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()`.
* 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:
Expand Down
20 changes: 0 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,6 @@ if( yaml-cpp_FOUND
)
endif()

configure_file(${CMAKE_SOURCE_DIR}/cmake/private/FairRootConfigVersion.cmake.in "${CMAKE_BINARY_DIR}/FairRootConfigVersion.cmake" @ONLY)

# Load the macro to generate the needed version info at compile time
Generate_Version_Info()

# Set some useful variables
SetBasicVariables()

Expand Down Expand Up @@ -302,9 +297,6 @@ install(FILES ${CMAKE_BINARY_DIR}/config.sh_install
install(FILES ${CMAKE_BINARY_DIR}/check_system.sh
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
)
install(FILES ${CMAKE_BINARY_DIR}/FairVersion.h
DESTINATION include
)
install(FILES ${CMAKE_BINARY_DIR}/config.csh_install
DESTINATION ${CMAKE_INSTALL_BINDIR}
RENAME FairRootConfig.csh
Expand All @@ -313,18 +305,6 @@ install(FILES ${CMAKE_BINARY_DIR}/check_system.csh
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
)

find_package(Git)
set (Git_VERSION ${GIT_VERSION_STRING})
string(REPLACE "git" " " Git_ROOT ${GIT_EXECUTABLE} )
If(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
Execute_Process(COMMAND ${GIT_EXECUTABLE} describe --tags
OUTPUT_VARIABLE PROJECT_GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
Else()
set(PROJECT_GIT_VERSION "v${PROJECT_VERSION}")
EndIf()
Configure_File(${CMAKE_SOURCE_DIR}/cmake/scripts/fairroot-config.in ${CMAKE_BINARY_DIR}/fairroot-config @ONLY)

install(PROGRAMS ${CMAKE_BINARY_DIR}/fairroot-config
Expand Down
24 changes: 0 additions & 24 deletions cmake/modules/FairMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -233,30 +233,6 @@ ENDMACRO(REMOVE_FROM_LIST)
################################################################################


Macro (Generate_Version_Info)
if(FairRoot_FOUND)

Add_Custom_Target(svnheader ALL)

Add_Custom_Command(TARGET svnheader
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${PROJECT_SOURCE_DIR}
-DBINARY_DIR=${CMAKE_BINARY_DIR}
-DINCLUDE_OUTPUT_DIRECTORY=${INCLUDE_OUTPUT_DIRECTORY}
-DFAIRROOT=${FAIRROOT_CMAKEMOD_DIR}
-P ${FAIRROOT_CMAKEMOD_DIR}/modules/GenerateVersionInfo.cmake
)
else()
Add_Custom_Target(svnheader ALL)
Add_Custom_Command(TARGET svnheader
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-DBINARY_DIR=${CMAKE_BINARY_DIR}
-DINCLUDE_OUTPUT_DIRECTORY=${INCLUDE_OUTPUT_DIRECTORY}
-P ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateVersionInfo.cmake
)
endif()
EndMacro (Generate_Version_Info)
################################################################################

Macro (SetBasicVariables)
if(FairRoot_FOUND)
if(TARGET fmt::fmt)
Expand Down
39 changes: 0 additions & 39 deletions cmake/modules/GenerateVersionInfo.cmake

This file was deleted.

3 changes: 0 additions & 3 deletions cmake/private/FairRootConfigVersion.cmake.in

This file was deleted.

5 changes: 0 additions & 5 deletions cmake/scripts/FairVersion.h.tmp

This file was deleted.

6 changes: 5 additions & 1 deletion fairroot/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

set(target Tools)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FairVersion.h.in ${CMAKE_BINARY_DIR}/FairVersion.h @ONLY)
list(APPEND extra_headers
${CMAKE_BINARY_DIR}/FairVersion.h)

set(sources
FairLogger.cxx
FairMonitor.cxx
Expand Down Expand Up @@ -46,4 +50,4 @@ fairroot_target_root_dictionary(${target}
)

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

0 comments on commit bc4f4bb

Please sign in to comment.