diff --git a/CMakeLists.txt b/CMakeLists.txt index d54ae447694ff8da43a7d08e00fe5f5fd25f0ead..8a14f063970e541a71688f75999cc1e216219e7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5) # NO_NINJA : Geant4 build fails with Ninja +set(GEANT4_SRCS_REPOSITORY https://gitlab.cern.ch/lhcb/Geant4-srcs.git CACHE STRING "Repository for Geant4 sources") + find_package(GaudiProject) gaudi_project(Geant4 v96r4p3 DATA Geant4Files VERSION v96r*) diff --git a/Geant4/G4config/CMakeLists.txt b/Geant4/G4config/CMakeLists.txt index 27c43cfb739286d60379d12eb752e5728910ade8..7145788d45bdec7ae8e374b8655fd79c8de2ab17 100644 --- a/Geant4/G4config/CMakeLists.txt +++ b/Geant4/G4config/CMakeLists.txt @@ -21,29 +21,32 @@ else() set(G4DATA ../share) endif() -if(DEFINED ENV{G4_NATIVE_VERSION}) - set(Geant4_tag $ENV{G4_NATIVE_VERSION}) - if(NOT Geant4_tag MATCHES "^4\\.") - # G4_NATIVE_VERSION might not contain the initial '4.' that we need - # see https://its.cern.ch/jira/browse/LHCBGAUSS-43 - set(Geant4_tag 4.${Geant4_tag}) +if (NOT GEANT4_TAG) + if(DEFINED ENV{G4_NATIVE_VERSION}) + set(GEANT4_TAG $ENV{G4_NATIVE_VERSION}) + if(NOT GEANT4_TAG MATCHES "^4\\.") + # G4_NATIVE_VERSION might not contain the initial '4.' that we need + # see https://its.cern.ch/jira/browse/LHCBGAUSS-43 + set(GEANT4_TAG 4.${GEANT4_TAG}) + endif() + if(NOT GEANT4_TAG MATCHES "^geant") + set(GEANT4_TAG geant${GEANT4_TAG}) + endif() + else() + set(GEANT4_TAG ${CMAKE_PROJECT_VERSION}) endif() - if(NOT Geant4_tag MATCHES "^geant") - set(Geant4_tag geant${Geant4_tag}) + # Special mapping of version HEAD + if(GEANT4_TAG STREQUAL "HEAD") + set(GEANT4_TAG master) endif() -else() - set(Geant4_tag ${CMAKE_PROJECT_VERSION}) -endif() -# Special mapping of version HEAD -if(Geant4_tag STREQUAL "HEAD") - set(Geant4_tag master) + set(GEANT4_TAG ${GEANT4_TAG} CACHE STRING "Tag of Geant4 to get from the Geant4-srcs repository") endif() include(ExternalProject) ExternalProject_Add(Geant4 - GIT_REPOSITORY https://gitlab.cern.ch/lhcb/Geant4-srcs.git - GIT_TAG ${Geant4_tag} + GIT_REPOSITORY ${GEANT4_SRCS_REPOSITORY} + GIT_TAG ${GEANT4_TAG} CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/toolchain.cmake -DGEANT4_BUILD_CXXSTD=${GAUDI_CXX_STANDARD} -DGEANT4_INSTALL_DATA=OFF