diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fc4440131..089d900078 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/CMakeLists.txt b/CMakeLists.txt index ce06f9922f..f66b683b66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() @@ -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 @@ -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 diff --git a/cmake/modules/FairMacros.cmake b/cmake/modules/FairMacros.cmake index 419fef362d..237eafd9e8 100644 --- a/cmake/modules/FairMacros.cmake +++ b/cmake/modules/FairMacros.cmake @@ -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) diff --git a/cmake/modules/GenerateVersionInfo.cmake b/cmake/modules/GenerateVersionInfo.cmake deleted file mode 100644 index d50f7dc358..0000000000 --- a/cmake/modules/GenerateVersionInfo.cmake +++ /dev/null @@ -1,39 +0,0 @@ - ################################################################################ - # Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH # - # # - # This software is distributed under the terms of the # - # GNU Lesser General Public Licence (LGPL) version 3, # - # copied verbatim in the file "LICENSE" # - ################################################################################ - # Configure FairVersion.h - # ------------------------------ - - Find_Package(Git) - - If(GIT_FOUND AND EXISTS "${SOURCE_DIR}/.git") - Execute_Process(COMMAND ${GIT_EXECUTABLE} describe --tags - OUTPUT_VARIABLE FAIRROOT_GIT_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE - WORKING_DIRECTORY ${SOURCE_DIR} - ) - Execute_Process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%cd - OUTPUT_VARIABLE FAIRROOT_GIT_DATE - OUTPUT_STRIP_TRAILING_WHITESPACE - WORKING_DIRECTORY ${SOURCE_DIR} - ) - Message(STATUS "FairRoot Version - ${FAIRROOT_GIT_VERSION} from - ${FAIRROOT_GIT_DATE}") - if(FAIRROOT) - Configure_File(${FAIRROOT}/scripts/FairVersion.h.tmp ${BINARY_DIR}/FairVersion.h @ONLY) - else(FAIRROOT) - Configure_File(${SOURCE_DIR}/cmake/scripts/FairVersion.h.tmp ${BINARY_DIR}/FairVersion.h @ONLY) - endif(FAIRROOT) - - Else() - include(${BINARY_DIR}/FairRootConfigVersion.cmake) - if(FAIRROOT) - Configure_File(${FAIRROOT}/scripts/FairVersion.h.default ${BINARY_DIR}/FairVersion.h @ONLY) - else(FAIRROOT) - Configure_File(${SOURCE_DIR}/cmake/scripts/FairVersion.h.default ${BINARY_DIR}/FairVersion.h @ONLY) - endif(FAIRROOT) - EndIf() - diff --git a/cmake/private/FairRootConfigVersion.cmake.in b/cmake/private/FairRootConfigVersion.cmake.in deleted file mode 100644 index d459eaba31..0000000000 --- a/cmake/private/FairRootConfigVersion.cmake.in +++ /dev/null @@ -1,3 +0,0 @@ - -set(@PROJECT_NAME@_VERSION "@PROJECT_VERSION@") - diff --git a/cmake/scripts/FairVersion.h.tmp b/cmake/scripts/FairVersion.h.tmp deleted file mode 100644 index f5944de092..0000000000 --- a/cmake/scripts/FairVersion.h.tmp +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef FAIRROOT_VERSION -#define FAIRROOT_VERSION "@PROJECT_GIT_VERSION@" -#define FAIRROOT_GIT_DATE "@PROJECT_GIT_DATE@" -#endif - diff --git a/fairroot/tools/CMakeLists.txt b/fairroot/tools/CMakeLists.txt index e95776f372..537c0f5ecf 100644 --- a/fairroot/tools/CMakeLists.txt +++ b/fairroot/tools/CMakeLists.txt @@ -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 @@ -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}) diff --git a/cmake/scripts/FairVersion.h.default b/fairroot/tools/FairVersion.h.in similarity index 60% rename from cmake/scripts/FairVersion.h.default rename to fairroot/tools/FairVersion.h.in index 76af862fb8..dc49ad417e 100644 --- a/cmake/scripts/FairVersion.h.default +++ b/fairroot/tools/FairVersion.h.in @@ -1,5 +1,3 @@ #ifndef FAIRROOT_VERSION #define FAIRROOT_VERSION "@PROJECT_VERSION@" -#define FAIRROOT_GIT_DATE "Sun Jan 1 00:00:00 0" #endif -