diff --git a/var/spack/repos/builtin/packages/geant4/CLHEP-10.03.03.patch b/var/spack/repos/builtin/packages/geant4/CLHEP-10.03.03.patch new file mode 100644 index 0000000000..b865f3bde2 --- /dev/null +++ b/var/spack/repos/builtin/packages/geant4/CLHEP-10.03.03.patch @@ -0,0 +1,34 @@ +diff --git a/cmake/Modules/FindCLHEP.cmake b/cmake/Modules/FindCLHEP.cmake +index 8b59f1c0a..f616d678e 100644 +--- a/cmake/Modules/FindCLHEP.cmake ++++ b/cmake/Modules/FindCLHEP.cmake +@@ -180,7 +180,10 @@ if(UNIX) + execute_process(COMMAND ${CLHEP_CONFIG_EXECUTABLE} --prefix + OUTPUT_VARIABLE _clhep_config_prefix + OUTPUT_STRIP_TRAILING_WHITESPACE) +- ++ if (_clhep_config_prefix) ++ # Remove wrapping double quotes. ++ string(REGEX REPLACE "\"(.*)\"" "\\1" _clhep_config_prefix "${_clhep_config_prefix}") ++ endif() + list(APPEND _clhep_root_hints ${_clhep_config_prefix}) + endif() + elseif(WIN32 AND NOT UNIX) +diff --git a/cmake/Templates/Geant4Config.cmake.in b/cmake/Templates/Geant4Config.cmake.in +index d6fe408b3..f355be2af 100644 +--- a/cmake/Templates/Geant4Config.cmake.in ++++ b/cmake/Templates/Geant4Config.cmake.in +@@ -268,13 +268,7 @@ set(Geant4_builtin_clhep_FOUND @GEANT4_USE_BUILTIN_CLHEP@) + if(NOT Geant4_builtin_clhep_FOUND) + set(Geant4_system_clhep_ISGRANULAR @GEANT4_USE_SYSTEM_CLHEP_GRANULAR@) + +- set(CLHEP_ROOT_DIR "@CLHEP_ROOT_DIR@") +- set(__GEANT4_OLD_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) +- set(CMAKE_MODULE_PATH "${_geant4_thisdir}/Modules" ${CMAKE_MODULE_PATH}) + find_package(CLHEP @CLHEP_VERSION@ REQUIRED @__g4_clhep_components@) +- set(CMAKE_MODULE_PATH ${__GEANT4_OLD_CMAKE_MODULE_PATH}) +- unset(CLHEP_ROOT_DIR) +- unset(__GEANT4_OLD_CMAKE_MODULE_PATH) + #CLHEP doesn't use target properties fully yet, so always include_directories + include_directories(${CLHEP_INCLUDE_DIRS}) + endif() diff --git a/var/spack/repos/builtin/packages/geant4/package.py b/var/spack/repos/builtin/packages/geant4/package.py index 085a5dc604..f2934817df 100644 --- a/var/spack/repos/builtin/packages/geant4/package.py +++ b/var/spack/repos/builtin/packages/geant4/package.py @@ -38,22 +38,19 @@ class Geant4(CMakePackage): # C++11 support depends_on("xerces-c cxxstd=11", when="cxxstd=11") - depends_on("clhep@2.4.0.0 cxxstd=11", when="@10.04 cxxstd=11") - depends_on("clhep@2.3.4.6 cxxstd=11", when="@10.03.p03 cxxstd=11") + depends_on("clhep@2.3.3.0: cxxstd=11", when="@10.03.p03: cxxstd=11") depends_on("vecgeom cxxstd=11", when="+vecgeom cxxstd=11") # C++14 support depends_on("xerces-c cxxstd=14", when="cxxstd=14") - depends_on("clhep@2.4.0.0 cxxstd=14", when="@10.04 cxxstd=14") - depends_on("clhep@2.3.4.6 cxxstd=14", when="@10.03.p03 cxxstd=14") + depends_on("clhep@2.3.3.0: cxxstd=14", when="@10.03.p03: cxxstd=14") depends_on("vecgeom cxxstd=14", when="+vecgeom cxxstd=14") # C++17 support depends_on("xerces-c cxxstd=17", when="cxxstd=17") + depends_on("clhep@2.3.3.0: cxxstd=17", when="@10.03.p03: cxxstd=17") patch('cxx17.patch', when='@:10.03.p99 cxxstd=17') patch('cxx17_geant4_10_0.patch', level=1, when='@10.04.00: cxxstd=17') - depends_on("clhep@2.4.0.0 cxxstd=17", when="@10.04 cxxstd=17") - depends_on("clhep@2.3.4.6 cxxstd=17", when="@10.03.p03 cxxstd=17") depends_on("vecgeom cxxstd=17", when="+vecgeom cxxstd=17") depends_on("expat") @@ -74,12 +71,17 @@ class Geant4(CMakePackage): depends_on('geant4-data@10.03.p03', when='@10.03.p03 ~data') depends_on('geant4-data@10.04', when='@10.04 ~data') + # As released, 10.03.03 has issues with respect to using external + # CLHEP. + patch('CLHEP-10.03.03.patch', level=1, when='@10.03.p03') + def cmake_args(self): spec = self.spec options = [ '-DGEANT4_USE_GDML=ON', '-DGEANT4_USE_SYSTEM_CLHEP=ON', + '-DGEANT4_USE_SYSTEM_CLHEP_GRANULAR=ON', '-DGEANT4_USE_G3TOG4=ON', '-DGEANT4_INSTALL_DATA=ON', '-DGEANT4_BUILD_TLS_MODEL=global-dynamic',