Geant4 Cross Reference |
1 # - Geant4 CMake Configuration File for Extern 1 # - Geant4 CMake Configuration File for External Projects 2 # This file is configured by Geant4 for use by 2 # This file is configured by Geant4 for use by an external project 3 # This file is configured by Geant4's CMake sy 3 # This file is configured by Geant4's CMake system and SHOULD NOT BE EDITED 4 # 4 # 5 # It defines the following variables 5 # It defines the following variables 6 # Geant4_INCLUDE_DIRS - include directories f 6 # Geant4_INCLUDE_DIRS - include directories for Geant4 >> 7 # Geant4_DEFINITIONS - compile definitions needed to use Geant4 7 # Geant4_LIBRARIES - libraries to link aga 8 # Geant4_LIBRARIES - libraries to link against 8 # Geant4_BUILD_TYPE - Build type (e.g. "Rel 9 # Geant4_BUILD_TYPE - Build type (e.g. "Release") used to build this 9 # install. Only set if 10 # install. Only set if Geant4 was installed using 10 # a single mode tool (e 11 # a single mode tool (e.g. make, ninja). 11 # Geant4_CXX_FLAGS - Recommended CXX flags 12 # Geant4_CXX_FLAGS - Recommended CXX flags for the compiler used to 12 # build the Geant4 libr 13 # build the Geant4 libraries. 13 # Geant4_CXX_FLAGS_<CONFIG> - Recommended CXX 14 # Geant4_CXX_FLAGS_<CONFIG> - Recommended CXX flags for build mode CONFIG. 14 # Geant4_USE_FILE - path to a CMake modul 15 # Geant4_USE_FILE - path to a CMake module which may be included to 15 # help setup CMake vari 16 # help setup CMake variables 16 # Geant4_CXXSTD - C++ Standard used to 17 # Geant4_CXXSTD - C++ Standard used to compile Geant4, e.g. c++98 17 # Geant4_TLS_MODEL - Thread Local Storage 18 # Geant4_TLS_MODEL - Thread Local Storage model used. Only set if 18 # the build used an exp 19 # the build used an explicit model. 19 # 20 # 20 # You may supply a version number through find 21 # You may supply a version number through find_package which will be checked 21 # against the version of this build. Standard 22 # against the version of this build. Standard CMake logic is used so that 22 # the EXACT flag may be passed, and otherwise 23 # the EXACT flag may be passed, and otherwise this build will report itself 23 # as compatible with the requested version if: 24 # as compatible with the requested version if: 24 # 25 # 25 # VERSION_OF_THIS_BUILD >= VERSION_REQUESTED 26 # VERSION_OF_THIS_BUILD >= VERSION_REQUESTED 26 # 27 # 27 # By default only the core (or kernel) of Gean 28 # By default only the core (or kernel) of Geant4 is activated by this 28 # module. You can specify additional component 29 # module. You can specify additional components of Geant4 through the 29 # COMPONENTS argument to find_package. By defa 30 # COMPONENTS argument to find_package. By default, all core libraries of 30 # Geant4 are appended to the Geant4_LIBRARIES 31 # Geant4 are appended to the Geant4_LIBRARIES variable. Specifying 31 # additional components will enable a check on 32 # additional components will enable a check on the existence of these 32 # components, with the following per component 33 # components, with the following per component variables being set: 33 # 34 # 34 # Geant4_${COMPONENT}_FOUND TRUE is the Ge 35 # Geant4_${COMPONENT}_FOUND TRUE is the Geant4 library "component" was 35 # found 36 # found 36 # 37 # 37 # Geant4_${COMPONENT}_LIBRARY Contains the l 38 # Geant4_${COMPONENT}_LIBRARY Contains the library for the specified 38 # "component" IF 39 # "component" IF the component is a library. 39 # 40 # 40 # In Geant4, components can be optional subcom 41 # In Geant4, components can be optional subcomponents of an always 41 # available library. In that case there will b 42 # available library. In that case there will be no 42 # Geant4_{COMPONENT}_LIBRARY variable. These n 43 # Geant4_{COMPONENT}_LIBRARY variable. These non-library components are 43 # generally activated by compile definitions t << 44 # generally activated by compile definitions, and in these cases the 44 # COMPILE_DEFINITIONS property. << 45 # appropriate definition will be added to the Geant4_DEFINITIONS component. 45 # 46 # 46 # If you use the REQUIRED and/or COMPONENTS ar 47 # If you use the REQUIRED and/or COMPONENTS arguments of find_package to 47 # specify components, then the module will iss 48 # specify components, then the module will issue a FATAL_ERROR if the 48 # found Geant4 does not have the requested com 49 # found Geant4 does not have the requested component(s). Any components 49 # specified through the OPTIONAL_COMPONENTS ar 50 # specified through the OPTIONAL_COMPONENTS argument will be enabled 50 # only if the found Geant4 supports them, with 51 # only if the found Geant4 supports them, with no error being raised if 51 # they are not supported. 52 # they are not supported. 52 # 53 # 53 # The components available generally correspon 54 # The components available generally correspond to configurations of 54 # the Geant4 libraries or optional extras that 55 # the Geant4 libraries or optional extras that Geant4 can be built with. 55 # 56 # 56 # Library Configuration 57 # Library Configuration 57 # --------------------- 58 # --------------------- 58 # static (Static libraries availab 59 # static (Static libraries available. Using this component 59 # when static libraries ar 60 # when static libraries are available will result in 60 # Geant4_LIBRARIES being p 61 # Geant4_LIBRARIES being populated with the static 61 # versions of the Geant4 l 62 # versions of the Geant4 libraries. It does not, and cannot, 62 # guarantee the use of sta 63 # guarantee the use of static third party libraries.) 63 # multithreaded (Libraries are multithrea 64 # multithreaded (Libraries are multithread capable) 64 # 65 # 65 # usolids (Geant4 solids are replac 66 # usolids (Geant4 solids are replaced with USolids equivalents) 66 # 67 # 67 # smartstack (G4event library G4StackM 68 # smartstack (G4event library G4StackManager uses G4SmartTrackStack) 68 # 69 # 69 # php_as_hp (G4processes library Part << 70 # << 71 # Optional Components 70 # Optional Components 72 # ------------------- 71 # ------------------- 73 # gdml (GDML support) 72 # gdml (GDML support) 74 # g3tog4 (Geant3 geometry call lis 73 # g3tog4 (Geant3 geometry call list reader library) 75 # freetype (G4analysis library has f 74 # freetype (G4analysis library has freetype support) 76 # hdf5 (G4analysis library has H 75 # hdf5 (G4analysis library has HDF5 support) 77 # 76 # 78 # ui_tcsh (TCsh Style Application C 77 # ui_tcsh (TCsh Style Application Command Line Interface) 79 # ui_win32 (WIN32 Style Application 78 # ui_win32 (WIN32 Style Application Command Line Interface) 80 # 79 # 81 # motif (Motif-X11/OpenGL Graphic 80 # motif (Motif-X11/OpenGL Graphical User Interface) 82 # qt (Qt/OpenGL Graphical User << 81 # qt (Qt4/OpenGL Graphical User Interface) 83 # 82 # 84 # vis_Vtk (VTK Graphical User Inter << 83 # vis_network_dawn (Client/Server network interface to DAWN visualization) 85 # vis_openinventor (OpenInventor visualizati << 84 # vis_network_vrml (Client/Server network interface to VRML visualization) 86 # vis_opengl_x11 (OpenGL visualization wit 85 # vis_opengl_x11 (OpenGL visualization with X11 interface) 87 # vis_opengl_win32 (OpenGL visualization wit 86 # vis_opengl_win32 (OpenGL visualization with X11 interface) 88 # vis_raytracer_x11 (RayTracer visualization 87 # vis_raytracer_x11 (RayTracer visualization with X11 interface) >> 88 # vis_openinventor (OpenInventor visualization) 89 # 89 # 90 # In addition, two 'shorthand' components are 90 # In addition, two 'shorthand' components are defined to help activate all 91 # available User Interface and Visualization d 91 # available User Interface and Visualization drivers: 92 # 92 # 93 # ui_all (All available UI drivers 93 # ui_all (All available UI drivers) 94 # vis_all (All available Vis driver 94 # vis_all (All available Vis drivers) 95 # 95 # 96 # These never result in a FATAL_ERROR, even if 96 # These never result in a FATAL_ERROR, even if the REQUIRED find_package 97 # argument is set. This is because these optio 97 # argument is set. This is because these options do not depend on specific 98 # components being available. 98 # components being available. 99 # 99 # 100 # You can also query whether the Geant4 found 100 # You can also query whether the Geant4 found uses the builtin or system 101 # versions of CLHEP, ZLIB, or Expat after call 101 # versions of CLHEP, ZLIB, or Expat after calling find_package via the variables 102 # 102 # 103 # Geant4_builtin_clhep_FOUND (TRUE if Geant 103 # Geant4_builtin_clhep_FOUND (TRUE if Geant4 built with internal CLHEP) 104 # Geant4_system_clhep_FOUND (TRUE if Geant 104 # Geant4_system_clhep_FOUND (TRUE if Geant4 built with external CLHEP) 105 # Geant4_builtin_expat_FOUND (TRUE if Geant 105 # Geant4_builtin_expat_FOUND (TRUE if Geant4 built with internal Expat) 106 # Geant4_builtin_zlib_FOUND (TRUE if Geant 106 # Geant4_builtin_zlib_FOUND (TRUE if Geant4 built with internal Zlib) 107 # 107 # 108 # These are not used via components as they do 108 # These are not used via components as they do not, in general, affect 109 # the use of Geant4 in an application unless y 109 # the use of Geant4 in an application unless you yourself make direct 110 # calls to these APIs. As the builtin librarie 110 # calls to these APIs. As the builtin libraries only contain the code 111 # required directly by the Geant4 toolkit, you 111 # required directly by the Geant4 toolkit, you may wish to perform a 112 # configure time check in these cases that the 112 # configure time check in these cases that the builtin libraries contain 113 # the calls required. In both cases, the Geant 113 # the calls required. In both cases, the Geant4_INCLUDE_DIRS and 114 # Geant4_LIBRARIES variables will be populated 114 # Geant4_LIBRARIES variables will be populated to use the builtin or 115 # system APIs as required, and you should use 115 # system APIs as required, and you should use these to ensure you compile 116 # and link against the same API version. 116 # and link against the same API version. 117 # 117 # >> 118 # An additional variable is set for CLHEP when Geant4 was built using a >> 119 # system install to indicate whether the single/granular CLHEP library/ies >> 120 # was/were linked against >> 121 # >> 122 # Geant4_system_clhep_ISGRANULAR (TRUE is Geant4 linked to granular CLHEP) >> 123 # 118 # Environment variables for, and directory pat 124 # Environment variables for, and directory paths to, physics datasets 119 # used by some Geant4 physics processes may be 125 # used by some Geant4 physics processes may be determined from the 120 # variables 126 # variables 121 # 127 # 122 # Geant4_DATASETS (List of data 128 # Geant4_DATASETS (List of dataset names known to Geant4) 123 # Geant4_DATASET_<NAME>_ENVVAR (Name of envi 129 # Geant4_DATASET_<NAME>_ENVVAR (Name of environment variable used by 124 # Geant4 to ob 130 # Geant4 to obtain path to dataset 125 # <NAME>) 131 # <NAME>) 126 # Geant4_DATASET_<NAME>_PATH (Path to data 132 # Geant4_DATASET_<NAME>_PATH (Path to dataset <NAME>. NB this may 127 # point to a n 133 # point to a non-existent path if Geant4 128 # was configur 134 # was configured not to install data) 129 # 135 # 130 #--------------------------------------------- 136 #----------------------------------------------------------------------- 131 # Variables used by this module which can chan 137 # Variables used by this module which can change the default behaviour of 132 # this module. They need to be set prior to th 138 # this module. They need to be set prior to the call to find_package 133 # 139 # 134 # Geant4_CONFIG_DEBUG If set, enable extra 140 # Geant4_CONFIG_DEBUG If set, enable extra messaging output which can 135 # be helpful in debugg 141 # be helpful in debugging and identifying problems 136 # with the configurati 142 # with the configuration. 137 # 143 # 138 #--------------------------------------------- 144 #----------------------------------------------------------------------- 139 145 >> 146 # Support CMake >= 3.8 >> 147 cmake_policy(VERSION 3.8) >> 148 if(CMAKE_VERSION VERSION_LESS 3.8) >> 149 message(FATAL_ERROR "Geant4Config requires CMake 3.8 or newer") >> 150 endif() >> 151 include(CMakeFindDependencyMacro) >> 152 140 #--------------------------------------------- 153 #----------------------------------------------------------------------- 141 # DEBUG : print out the variables passed via f 154 # DEBUG : print out the variables passed via find_package arguments 142 # 155 # 143 if(Geant4_CONFIG_DEBUG) 156 if(Geant4_CONFIG_DEBUG) 144 message(STATUS "G4CFG_DEBUG : Geant4_VERSION 157 message(STATUS "G4CFG_DEBUG : Geant4_VERSION = ${Geant4_VERSION}") 145 message(STATUS "G4CFG_DEBUG : Geant4_FIND_VE 158 message(STATUS "G4CFG_DEBUG : Geant4_FIND_VERSION = ${Geant4_FIND_VERSION}") 146 message(STATUS "G4CFG_DEBUG : Geant4_FIND_RE 159 message(STATUS "G4CFG_DEBUG : Geant4_FIND_REQUIRED = ${Geant4_FIND_REQUIRED}") 147 message(STATUS "G4CFG_DEBUG : Geant4_FIND_CO 160 message(STATUS "G4CFG_DEBUG : Geant4_FIND_COMPONENTS = ${Geant4_FIND_COMPONENTS}") 148 161 149 foreach(_cpt ${Geant4_FIND_COMPONENTS}) 162 foreach(_cpt ${Geant4_FIND_COMPONENTS}) 150 message(STATUS "G4CFG_DEBUG : Geant4_FIND_ 163 message(STATUS "G4CFG_DEBUG : Geant4_FIND_REQUIRED_${_cpt} = ${Geant4_FIND_REQUIRED_${_cpt}}") 151 endforeach() 164 endforeach() 152 165 153 message(STATUS "G4CFG_DEBUG : Geant4_LIBDEPS 166 message(STATUS "G4CFG_DEBUG : Geant4_LIBDEPS_LOADED = ${Geant4_LIBDEPS_LOADED}") 154 endif() 167 endif() 155 168 156 #--------------------------------------------- 169 #----------------------------------------------------------------------- 157 # Check that consumers use the minimum needed << 158 # Geant4 uses cxx_std_EP to define the standar << 159 # 3.8 and above support EP=17. 3.12 and above << 160 # We continue to support the earlier version w << 161 cmake_policy(VERSION 3.8...3.18) << 162 if(CMAKE_VERSION VERSION_LESS 3.8) << 163 message(FATAL_ERROR "Projects consuming Gean << 164 endif() << 165 << 166 if(("@CMAKE_CXX_STANDARD@" GREATER_EQUAL 23) A << 167 message(FATAL_ERROR "Projects consuming Gean << 168 endif() << 169 << 170 if(("@CMAKE_CXX_STANDARD@" GREATER_EQUAL 20) A << 171 message(FATAL_ERROR "Projects consuming Gean << 172 endif() << 173 << 174 # - Help find dependencies << 175 include(CMakeFindDependencyMacro) << 176 << 177 #--------------------------------------------- << 178 # Locate ourselves, since all other config fil 170 # Locate ourselves, since all other config files should have been 179 # installed alongside us... 171 # installed alongside us... 180 # 172 # 181 get_filename_component(_geant4_thisdir "${CMAK 173 get_filename_component(_geant4_thisdir "${CMAKE_CURRENT_LIST_FILE}" PATH) 182 174 183 #--------------------------------------------- 175 #----------------------------------------------------------------------- 184 # Provide *recommended* compiler flags used by 176 # Provide *recommended* compiler flags used by this build of Geant4 185 # Don't mess with the actual CMAKE_CXX_FLAGS!! 177 # Don't mess with the actual CMAKE_CXX_FLAGS!!! 186 # It's up to the user what to do with these 178 # It's up to the user what to do with these 187 @GEANT4_COMPILER_FLAG_HINTS@ 179 @GEANT4_COMPILER_FLAG_HINTS@ 188 180 189 # - Provide variable indicating C++ Standard w 181 # - Provide variable indicating C++ Standard we were compiled against 190 set(Geant4_CXX_STANDARD "@CMAKE_CXX_STANDARD@" << 182 set(Geant4_CXXSTD "c++@GEANT4_BUILD_CXXSTD@") >> 183 >> 184 #----------------------------------------------------------------------- >> 185 # Set the base compile definitions required to use Geant4 if the variable >> 186 # does not exist (we do this to ensure multiple calls to find_package >> 187 # don't overwrite previous invocations) >> 188 # Components may append to this, but should prefer usage requirements >> 189 # via INTERFACE_COMPILE_DEFINITIONS >> 190 if(NOT Geant4_DEFINITIONS) >> 191 set(Geant4_DEFINITIONS @GEANT4_CORE_DEFINITIONS@) >> 192 endif() 191 193 192 #--------------------------------------------- 194 #----------------------------------------------------------------------- 193 # Configure the path to the Geant4 headers, us 195 # Configure the path to the Geant4 headers, using a relative path if 194 # possible. This is only known at CMake time, 196 # possible. This is only known at CMake time, so we expand a CMake 195 # supplied variable. 197 # supplied variable. 196 # 198 # 197 @GEANT4_INCLUDE_DIR_SETUP@ 199 @GEANT4_INCLUDE_DIR_SETUP@ 198 set(Geant4_INCLUDE_DIRS "${Geant4_INCLUDE_DIR} 200 set(Geant4_INCLUDE_DIRS "${Geant4_INCLUDE_DIR}") 199 201 200 # Push our own module path onto the CMake one 202 # Push our own module path onto the CMake one to help refind dependencies 201 # - Popped at end of this module 203 # - Popped at end of this module 202 list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRE 204 list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}/Modules") 203 205 204 #--------------------------------------------- 206 #----------------------------------------------------------------------- 205 # Data Resources 207 # Data Resources 206 # NB: Because data paths can be "forward decla 208 # NB: Because data paths can be "forward declared" these offer no 207 # guarantee of data existence. They only provi 209 # guarantee of data existence. They only provide a hint. 208 # 210 # 209 set(Geant4_DATASET_DESCRIPTIONS "@GEANT4_DATAS 211 set(Geant4_DATASET_DESCRIPTIONS "@GEANT4_DATASET_DESCRIPTIONS@") 210 212 211 foreach(_g4dataset_tuple ${Geant4_DATASET_DESC 213 foreach(_g4dataset_tuple ${Geant4_DATASET_DESCRIPTIONS}) 212 # Format is NAME|ENVVAR|PATH 214 # Format is NAME|ENVVAR|PATH 213 string(REPLACE "|" ";" _g4dataset_tuple "${_ 215 string(REPLACE "|" ";" _g4dataset_tuple "${_g4dataset_tuple}") 214 list(GET _g4dataset_tuple 0 _g4dataset_name) 216 list(GET _g4dataset_tuple 0 _g4dataset_name) 215 list(APPEND Geant4_DATASETS ${_g4dataset_nam 217 list(APPEND Geant4_DATASETS ${_g4dataset_name}) 216 list(GET _g4dataset_tuple 1 Geant4_DATASET_$ 218 list(GET _g4dataset_tuple 1 Geant4_DATASET_${_g4dataset_name}_ENVVAR) 217 list(GET _g4dataset_tuple 2 Geant4_DATASET_$ 219 list(GET _g4dataset_tuple 2 Geant4_DATASET_${_g4dataset_name}_PATH) 218 endforeach() 220 endforeach() 219 unset(Geant4_DATASET_DESCRIPTIONS) 221 unset(Geant4_DATASET_DESCRIPTIONS) 220 222 221 #--------------------------------------------- 223 #----------------------------------------------------------------------- 222 # Optional Build Components << 224 # Setup components. 223 #--------------------------------------------- << 224 # - General Multithreading << 225 set(Geant4_multithreaded_FOUND @GEANT4_BUILD_M << 226 if(Geant4_multithreaded_FOUND) << 227 # - Define variable to indicate TLS model us << 228 set(Geant4_TLS_MODEL "@GEANT4_BUILD_TLS_MODE << 229 if(Geant4_TLS_MODEL STREQUAL "auto") << 230 unset(Geant4_TLS_MODEL) << 231 endif() << 232 endif() << 233 << 234 # - Smart track stack << 235 set(Geant4_smartstack_FOUND @GEANT4_USE_SMARTS << 236 << 237 # - ParticleHP as HP << 238 set(Geant4_php_as_hp_FOUND @GEANT4_BUILD_PHP_A << 239 << 240 # - G3toG4 << 241 set(Geant4_g3tog4_FOUND @GEANT4_USE_G3TOG4@) << 242 if(Geant4_g3tog4_FOUND) << 243 if(Geant4_FIND_REQUIRED_g3tog4) << 244 set(_geant4_use_g3tog4_library ON) << 245 endif() << 246 endif() << 247 << 248 #--------------------------------------------- << 249 # Optional Components that may depend on exter << 250 #--------------------------------------------- 225 #----------------------------------------------------------------------- >> 226 # Many components are simply present as parts of libraries or always built >> 227 # but require additional compile definitions. >> 228 # 251 # Optionally import build-time package setting 229 # Optionally import build-time package settings to provide hard values 252 # for find_package to work with 230 # for find_package to work with 253 include("${CMAKE_CURRENT_LIST_DIR}/Geant4Packa 231 include("${CMAKE_CURRENT_LIST_DIR}/Geant4PackageCache.cmake" OPTIONAL) 254 232 255 # - CLHEP << 233 # Builtin/External packages 256 set(Geant4_system_clhep_FOUND @GEANT4_USE_SYST 234 set(Geant4_system_clhep_FOUND @GEANT4_USE_SYSTEM_CLHEP@) >> 235 257 if(Geant4_system_clhep_FOUND) 236 if(Geant4_system_clhep_FOUND) 258 set(Geant4_builtin_clhep_FOUND FALSE) 237 set(Geant4_builtin_clhep_FOUND FALSE) 259 find_dependency(CLHEP @CLHEP_VERSION@ EXACT << 238 set(Geant4_system_clhep_ISGRANULAR @GEANT4_USE_SYSTEM_CLHEP_GRANULAR@) >> 239 if(Geant4_system_clhep_ISGRANULAR) >> 240 find_dependency(CLHEP @CLHEP_VERSION@ EXACT COMPONENTS @__g4_clhep_components@ CONFIG) >> 241 else() >> 242 find_dependency(CLHEP @CLHEP_VERSION@ EXACT CONFIG) >> 243 endif() >> 244 # Explicitly use include_directories. >> 245 # - Geant4 and CLHEP use full imported targets with usage requirements, >> 246 # but ROOT (used in the examples), ignores usage requirements in dictionary >> 247 # generation steps. >> 248 # To retain comptibility with examples, explictly include_directories >> 249 # for CLHEP. This is a *pure workaround* for the use case of a project >> 250 # using ROOT that generates dictionaries for class headers that >> 251 # #include Geant4 headers... >> 252 include_directories(${CLHEP_INCLUDE_DIRS}) 260 else() 253 else() 261 set(Geant4_builtin_clhep_FOUND TRUE) 254 set(Geant4_builtin_clhep_FOUND TRUE) 262 endif() 255 endif() 263 256 264 # - EXPAT << 265 set(Geant4_builtin_expat_FOUND @GEANT4_USE_BUI 257 set(Geant4_builtin_expat_FOUND @GEANT4_USE_BUILTIN_EXPAT@) 266 if(NOT Geant4_builtin_expat_FOUND) 258 if(NOT Geant4_builtin_expat_FOUND) 267 find_dependency(EXPAT @EXPAT_VERSION_STRING@ 259 find_dependency(EXPAT @EXPAT_VERSION_STRING@) 268 include("${CMAKE_CURRENT_LIST_DIR}/G4EXPATSh 260 include("${CMAKE_CURRENT_LIST_DIR}/G4EXPATShim.cmake") 269 endif() 261 endif() 270 262 271 # - ZLIB << 272 set(Geant4_builtin_zlib_FOUND @GEANT4_USE_BUIL 263 set(Geant4_builtin_zlib_FOUND @GEANT4_USE_BUILTIN_ZLIB@) 273 if(NOT Geant4_builtin_zlib_FOUND) 264 if(NOT Geant4_builtin_zlib_FOUND) 274 find_dependency(ZLIB @ZLIB_VERSION_STRING@) 265 find_dependency(ZLIB @ZLIB_VERSION_STRING@) 275 endif() 266 endif() 276 267 277 # - PTL/TBB << 268 # - Multithreading 278 set(Geant4_system_ptl_FOUND @GEANT4_USE_SYSTEM << 269 set(Geant4_multithreaded_FOUND @GEANT4_BUILD_MULTITHREADED@) 279 set(Geant4_TBB_FOUND @GEANT4_USE_TBB@) << 270 if(Geant4_multithreaded_FOUND) 280 if(Geant4_system_ptl_FOUND) << 271 # - Define variable to indicate TLS model used 281 set(Geant4_builtin_ptl_FOUND FALSE) << 272 set(Geant4_TLS_MODEL "@GEANT4_BUILD_TLS_MODEL@") 282 if(Geant4_TBB_FOUND) << 273 if(Geant4_TLS_MODEL STREQUAL "auto") 283 find_dependency(PTL @PTL_VERSION@ COMPONEN << 274 unset(Geant4_TLS_MODEL) 284 else() << 285 find_dependency(PTL @PTL_VERSION@) << 286 endif() << 287 else() << 288 # We know exactly where PTL is << 289 set(Geant4_builtin_ptl_FOUND TRUE) << 290 if(CMAKE_VERSION VERSION_GREATER 3.8.9999) << 291 find_dependency(PTL NO_DEFAULT_PATH PATHS << 292 else() << 293 find_package(PTL REQUIRED NO_DEFAULT_PATH << 294 endif() 275 endif() 295 endif() 276 endif() 296 277 297 # - GDML 278 # - GDML 298 set(Geant4_gdml_FOUND @GEANT4_USE_GDML@) 279 set(Geant4_gdml_FOUND @GEANT4_USE_GDML@) 299 if(Geant4_gdml_FOUND) 280 if(Geant4_gdml_FOUND) 300 find_dependency(XercesC @XercesC_VERSION@) 281 find_dependency(XercesC @XercesC_VERSION@) 301 endif() 282 endif() 302 283 >> 284 # - Smart track stack >> 285 set(Geant4_smartstack_FOUND @GEANT4_USE_SMARTSTACK@) >> 286 >> 287 # - TiMemory >> 288 set(Geant4_timemory_FOUND @GEANT4_USE_TIMEMORY@) >> 289 if(Geant4_timemory_FOUND) >> 290 set(_geant4_use_timemory_library ON) >> 291 set(timemory_DIR "@timemory_DIR@" CACHE PATH "timemory installation for Geant4") >> 292 set(timemory_FIND_COMPONENTS_INTERFACE @timemory_FIND_COMPONENTS_INTERFACE@) >> 293 find_package(timemory @G4timemory_VERSION@ REQUIRED QUIET COMPONENTS @G4timemory_COMPONENTS@) >> 294 set(timemory_LIBRARIES @timemory_FIND_COMPONENTS_INTERFACE@) >> 295 endif() >> 296 >> 297 # - G3toG4 >> 298 set(Geant4_g3tog4_FOUND @GEANT4_USE_G3TOG4@) >> 299 if(Geant4_g3tog4_FOUND) >> 300 if(Geant4_FIND_REQUIRED_g3tog4) >> 301 set(_geant4_use_g3tog4_library ON) >> 302 endif() >> 303 endif() >> 304 303 # - VecGeom 305 # - VecGeom 304 set(Geant4_usolids_FOUND @GEANT4_USE_USOLIDS_E 306 set(Geant4_usolids_FOUND @GEANT4_USE_USOLIDS_EITHER@) 305 if(Geant4_usolids_FOUND) 307 if(Geant4_usolids_FOUND) 306 find_dependency(VecGeom @VecGeom_VERSION@) 308 find_dependency(VecGeom @VecGeom_VERSION@) >> 309 include("${CMAKE_CURRENT_LIST_DIR}/G4VecGeomShim.cmake") 307 endif() 310 endif() 308 311 309 # - Freetype 312 # - Freetype 310 set(Geant4_freetype_FOUND @GEANT4_USE_FREETYPE 313 set(Geant4_freetype_FOUND @GEANT4_USE_FREETYPE@) 311 if(Geant4_freetype_FOUND) 314 if(Geant4_freetype_FOUND) 312 find_dependency(Freetype @FREETYPE_VERSION_S 315 find_dependency(Freetype @FREETYPE_VERSION_STRING@) 313 include("${CMAKE_CURRENT_LIST_DIR}/G4Freetyp 316 include("${CMAKE_CURRENT_LIST_DIR}/G4FreetypeShim.cmake") 314 endif() 317 endif() 315 318 316 # - HDF5 319 # - HDF5 317 set(Geant4_hdf5_FOUND @GEANT4_USE_HDF5@) 320 set(Geant4_hdf5_FOUND @GEANT4_USE_HDF5@) 318 if(Geant4_hdf5_FOUND) 321 if(Geant4_hdf5_FOUND) 319 find_dependency(HDF5) << 322 find_dependency(HDF5 @HDF5_VERSION@) 320 include("${CMAKE_CURRENT_LIST_DIR}/G4HDF5Shi 323 include("${CMAKE_CURRENT_LIST_DIR}/G4HDF5Shim.cmake") 321 endif() 324 endif() 322 325 323 #--------------------------------------------- 326 #----------------------------------------------------------------------- 324 # UI/VIS 327 # UI/VIS 325 # 328 # 326 # Prefer Legacy GL when using CMake >= 3.10 329 # Prefer Legacy GL when using CMake >= 3.10 327 set(OpenGL_GL_PREFERENCE_SAVE "${OpenGL_GL_PRE 330 set(OpenGL_GL_PREFERENCE_SAVE "${OpenGL_GL_PREFERENCE}") 328 set(OpenGL_GL_PREFERENCE "LEGACY") 331 set(OpenGL_GL_PREFERENCE "LEGACY") 329 332 330 # - Helper variables for ui/vis_all components 333 # - Helper variables for ui/vis_all components 331 if("ui_all" IN_LIST Geant4_FIND_COMPONENTS) 334 if("ui_all" IN_LIST Geant4_FIND_COMPONENTS) 332 set(Geant4_ui_all_FOUND TRUE) 335 set(Geant4_ui_all_FOUND TRUE) 333 endif() 336 endif() 334 337 335 if("vis_all" IN_LIST Geant4_FIND_COMPONENTS) 338 if("vis_all" IN_LIST Geant4_FIND_COMPONENTS) 336 set(Geant4_vis_all_FOUND TRUE) 339 set(Geant4_vis_all_FOUND TRUE) 337 endif() 340 endif() 338 341 339 # - UI : TCSH 342 # - UI : TCSH 340 set(Geant4_ui_tcsh_FOUND @UNIX@) 343 set(Geant4_ui_tcsh_FOUND @UNIX@) >> 344 if(Geant4_ui_tcsh_FOUND) >> 345 if(("ui_tcsh" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND) >> 346 list(APPEND Geant4_DEFINITIONS -DG4UI_USE_TCSH) >> 347 endif() >> 348 endif() 341 349 342 # - UI : win32 350 # - UI : win32 343 set(Geant4_ui_win32_FOUND @WIN32@) 351 set(Geant4_ui_win32_FOUND @WIN32@) >> 352 if(Geant4_ui_win32_FOUND) >> 353 if(("ui_win32" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND) >> 354 list(APPEND >> 355 Geant4_DEFINITIONS >> 356 -DG4INTY_USE_WIN32 >> 357 -DG4UI_USE_WIN32 >> 358 ) >> 359 endif() >> 360 endif() >> 361 >> 362 # - Visualization : Network DAWN >> 363 set(Geant4_vis_dawn_network_FOUND @GEANT4_USE_NETWORK_DAWN@) >> 364 if(Geant4_vis_dawn_network_FOUND) >> 365 if(("vis_dawn_network" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 366 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_DAWN) >> 367 endif() >> 368 endif() >> 369 >> 370 # - Visualization : Network VRML >> 371 set(Geant4_vis_vrml_network_FOUND @GEANT4_USE_NETWORK_VRML@) >> 372 if(Geant4_vis_vrml_network_FOUND) >> 373 if(("vis_vrml_network" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 374 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_VRML) >> 375 endif() >> 376 endif() 344 377 345 #--------------------------------------------- 378 #----------------------------------------------------------------------- 346 # Components which requires slightly more comp 379 # Components which requires slightly more complex setup 347 # 380 # 348 # - Visualization : RayTracerX 381 # - Visualization : RayTracerX 349 set(Geant4_vis_raytracer_x11_FOUND @GEANT4_USE 382 set(Geant4_vis_raytracer_x11_FOUND @GEANT4_USE_RAYTRACER_X11@) 350 if(Geant4_vis_raytracer_x11_FOUND) 383 if(Geant4_vis_raytracer_x11_FOUND) 351 find_dependency(X11) 384 find_dependency(X11) 352 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim 385 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake") >> 386 >> 387 if(("vis_raytracer_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 388 list(APPEND >> 389 Geant4_DEFINITIONS >> 390 -DG4INTY_USE_XT >> 391 -DG4VIS_USE_RAYTRACERX >> 392 ) >> 393 endif() 353 endif() 394 endif() 354 395 355 # - Qt (UI and Vis!) 396 # - Qt (UI and Vis!) 356 set(Geant4_qt_FOUND @GEANT4_USE_QT@) 397 set(Geant4_qt_FOUND @GEANT4_USE_QT@) 357 set(Geant4_qt3d_FOUND @GEANT4_USE_QT3D@) << 398 set(Geant4_USES_QT5 @Qt5Core_FOUND@) 358 if(Geant4_qt_FOUND) 399 if(Geant4_qt_FOUND) 359 # Must always refind Qt to recreate imported << 400 # Must always refind Qt5 to recreate imported targets. Because these 360 # are in the public interface, always need l 401 # are in the public interface, always need linking. 361 find_dependency(Qt@QT_VERSION_MAJOR@Core REQ << 402 if(Geant4_USES_QT5) 362 find_dependency(Qt@QT_VERSION_MAJOR@Gui REQU << 403 find_dependency(Qt5Core REQUIRED) 363 find_dependency(Qt@QT_VERSION_MAJOR@Widgets << 404 find_dependency(Qt5Gui REQUIRED) 364 find_dependency(Qt@QT_VERSION_MAJOR@OpenGL R << 405 find_dependency(Qt5Widgets REQUIRED) 365 if(@QT_VERSION_MAJOR@ GREATER 5) << 406 find_dependency(Qt5OpenGL REQUIRED) 366 find_dependency(Qt@QT_VERSION_MAJOR@OpenGL << 407 find_dependency(Qt5PrintSupport REQUIRED) 367 endif() << 408 else() 368 << 409 find_dependency(Qt4 REQUIRED QtCore QtGui QtOpenGL) 369 if(Geant4_qt3d_FOUND) << 370 find_dependency(Qt@QT_VERSION_MAJOR@3DCore << 371 find_dependency(Qt@QT_VERSION_MAJOR@3DExtr << 372 find_dependency(Qt@QT_VERSION_MAJOR@3DRend << 373 endif() 410 endif() 374 411 375 # Also require OpenGL 412 # Also require OpenGL 376 find_dependency(OpenGL) 413 find_dependency(OpenGL) 377 414 378 # Qt must be activated both directly and for << 415 if(("qt" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND) 379 if(("qt" IN_LIST Geant4_FIND_COMPONENTS) << 416 list(APPEND 380 OR ("vis_openinventor" IN_LIST Geant4_FIN << 417 Geant4_DEFINITIONS 381 OR Geant4_ui_all_FOUND OR Geant4_vis_all_ << 418 -DG4INTY_USE_QT >> 419 -DG4UI_USE_QT >> 420 -DG4VIS_USE_OPENGLQT >> 421 ) 382 set(_geant4_use_opengl_library ON) 422 set(_geant4_use_opengl_library ON) 383 # Qt3D is always on if available << 384 set(_geant4_use_qt3D_library ${Geant4_qt3d << 385 endif() 423 endif() 386 endif() 424 endif() 387 425 >> 426 # - Wt (UI and Vis!) >> 427 #set(Geant4_wt_FOUND @GEANT4_USE_WT@) >> 428 #if(Geant4_wt_FOUND) >> 429 # find_dependency(Wt) >> 430 # find_dependency(OpenGL) >> 431 # if(("wt" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND) >> 432 # list(APPEND >> 433 # Geant4_DEFINITIONS >> 434 # -DG4INTY_USE_WT >> 435 # -DG4UI_USE_WT >> 436 # -DG4VIS_USE_OPENGLWT >> 437 # ) >> 438 # set(_geant4_use_opengl_library ON) >> 439 # endif() >> 440 #endif() >> 441 388 # - Motif (UI and Vis!) 442 # - Motif (UI and Vis!) 389 set(Geant4_motif_FOUND @GEANT4_USE_XM@) 443 set(Geant4_motif_FOUND @GEANT4_USE_XM@) 390 if(Geant4_motif_FOUND) 444 if(Geant4_motif_FOUND) 391 find_dependency(X11) 445 find_dependency(X11) 392 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim 446 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake") 393 find_dependency(Motif) 447 find_dependency(Motif) 394 include("${CMAKE_CURRENT_LIST_DIR}/G4MotifSh 448 include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake") >> 449 find_dependency(OpenGL) 395 if(APPLE) 450 if(APPLE) 396 find_dependency(XQuartzGL) 451 find_dependency(XQuartzGL) 397 else() << 398 find_dependency(OpenGL) << 399 endif() 452 endif() 400 453 401 # Motif can be activated both directly and f << 454 if(("motif" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND) 402 if(("motif" IN_LIST Geant4_FIND_COMPONENTS) << 455 list(APPEND 403 OR ("vis_openinventor" IN_LIST Geant4_FIN << 456 Geant4_DEFINITIONS 404 OR Geant4_ui_all_FOUND OR Geant4_vis_all_ << 457 -DG4INTY_USE_XT >> 458 -DG4UI_USE_XM >> 459 -DG4VIS_USE_OPENGLXM >> 460 ) 405 set(_geant4_use_opengl_library ON) 461 set(_geant4_use_opengl_library ON) 406 endif() 462 endif() 407 endif() 463 endif() 408 464 409 # - OpenGL X11 465 # - OpenGL X11 410 set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OP 466 set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OPENGL_X11@) 411 if(Geant4_vis_opengl_x11_FOUND) 467 if(Geant4_vis_opengl_x11_FOUND) 412 find_dependency(X11) 468 find_dependency(X11) 413 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim 469 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake") >> 470 find_dependency(OpenGL) 414 if(APPLE) 471 if(APPLE) 415 find_dependency(XQuartzGL) 472 find_dependency(XQuartzGL) 416 else() << 417 find_dependency(OpenGL) << 418 endif() 473 endif() 419 474 420 if(("vis_opengl_x11" IN_LIST Geant4_FIND_COM 475 if(("vis_opengl_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 476 list(APPEND >> 477 Geant4_DEFINITIONS >> 478 -DG4INTY_USE_XT >> 479 -DG4VIS_USE_OPENGLX >> 480 ) 421 set(_geant4_use_opengl_library ON) 481 set(_geant4_use_opengl_library ON) 422 endif() 482 endif() 423 endif() 483 endif() 424 484 425 # - OpenGL Win32 485 # - OpenGL Win32 426 set(Geant4_vis_opengl_win32_FOUND @GEANT4_USE_ 486 set(Geant4_vis_opengl_win32_FOUND @GEANT4_USE_OPENGL_WIN32@) 427 if(Geant4_vis_opengl_win32_FOUND) 487 if(Geant4_vis_opengl_win32_FOUND) 428 find_dependency(OpenGL) 488 find_dependency(OpenGL) 429 if(("vis_opengl_win32" IN_LIST Geant4_FIND_C 489 if(("vis_opengl_win32" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 490 list(APPEND >> 491 Geant4_DEFINITIONS >> 492 -DG4INTY_USE_WIN32 >> 493 -DG4VIS_USE_OPENGLWIN32 >> 494 ) 430 set(_geant4_use_opengl_library ON) 495 set(_geant4_use_opengl_library ON) 431 endif() 496 endif() 432 endif() 497 endif() 433 498 434 # - OpenInventor 499 # - OpenInventor 435 set(Geant4_vis_openinventor_FOUND @GEANT4_USE_ 500 set(Geant4_vis_openinventor_FOUND @GEANT4_USE_INVENTOR@) 436 set(Geant4_vis_openinventor_qt_FOUND @GEANT4_U << 437 if(Geant4_vis_openinventor_FOUND) 501 if(Geant4_vis_openinventor_FOUND) 438 find_dependency(Coin) << 502 if(("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) 439 << 503 if(UNIX AND NOT WIN32) 440 if(Geant4_vis_openinventor_qt_FOUND) << 504 list(APPEND Geant4_DEFINITIONS 441 # Qt dependency handled by Geant4_vis_qt_F << 505 -DG4INTY_USE_XT 442 # always ON if Inventor_QT is << 506 -DG4VIS_USE_OI 443 find_dependency(SoQt) << 507 -DG4VIS_USE_OIX 444 else() << 508 ) 445 if(WIN32) << 509 elseif(WIN32) 446 find_dependency(SoWin) << 510 list(APPEND Geant4_DEFINITIONS 447 else() << 511 -G4INTY_USE_WIN32 448 # Motif/X11/GL dependency handled by Gea << 512 -DG4VIS_USE_OI 449 # always ON if Inventor/Xt is. << 513 -DG4VIS_USE_OIWIN32 450 find_dependency(SoXt) << 514 ) 451 endif() 515 endif() 452 endif() << 453 516 454 if(("vis_openinventor" IN_LIST Geant4_FIND_C << 455 set(_geant4_use_inventor_library ON) 517 set(_geant4_use_inventor_library ON) 456 endif() 518 endif() 457 endif() 519 endif() 458 520 459 # Reset any OpenGL Preference 521 # Reset any OpenGL Preference 460 set(OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFEREN 522 set(OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFERENCE_SAVE}") 461 523 462 set(Geant4_vis_Vtk_FOUND @GEANT4_USE_VTK@) << 463 if(Geant4_vis_Vtk_FOUND) << 464 find_dependency(VTK 9 REQUIRED COMPONENTS << 465 CommonColor << 466 InteractionStyle << 467 IOExport << 468 GUISupportQt << 469 RenderingVolumeOpenGL2 << 470 ) << 471 set(_geant4_use_vtk_library ON) << 472 endif() << 473 << 474 #--------------------------------------------- 524 #----------------------------------------------------------------------- 475 # Include the files listing all the imported t 525 # Include the files listing all the imported targets and configuring 476 # Intel/MSVC Compile Features 526 # Intel/MSVC Compile Features 477 # (Not needed if used in the same Geant4 proje 527 # (Not needed if used in the same Geant4 project, or if we have run before) 478 # This is always installed in the same locatio 528 # This is always installed in the same location as us... 479 # 529 # 480 if(NOT CMAKE_PROJECT_NAME STREQUAL Geant4) 530 if(NOT CMAKE_PROJECT_NAME STREQUAL Geant4) 481 include("${_geant4_thisdir}/Modules/IntelCom 531 include("${_geant4_thisdir}/Modules/IntelCompileFeatures.cmake") 482 include("${_geant4_thisdir}/Modules/MSVCComp 532 include("${_geant4_thisdir}/Modules/MSVCCompileFeatures.cmake") 483 533 484 if(NOT Geant4_LIBDEPS_LOADED) 534 if(NOT Geant4_LIBDEPS_LOADED) 485 include("${_geant4_thisdir}/Geant4LibraryD 535 include("${_geant4_thisdir}/Geant4LibraryDepends.cmake") 486 set(Geant4_LIBDEPS_LOADED 1) 536 set(Geant4_LIBDEPS_LOADED 1) 487 endif() 537 endif() 488 endif() 538 endif() 489 539 490 #--------------------------------------------- 540 #----------------------------------------------------------------------- 491 # Now perform final configuration of libraries 541 # Now perform final configuration of libraries... 492 # We provide FOUND variables for presence of s 542 # We provide FOUND variables for presence of shared and static 493 # User can supply "static" component to force 543 # User can supply "static" component to force use of static libraries, if 494 # available. 544 # available. 495 set(Geant4_shared_FOUND @BUILD_SHARED_LIBS@) 545 set(Geant4_shared_FOUND @BUILD_SHARED_LIBS@) 496 set(Geant4_static_FOUND @BUILD_STATIC_LIBS@) 546 set(Geant4_static_FOUND @BUILD_STATIC_LIBS@) 497 547 498 # - Default setting : shared if available, sta 548 # - Default setting : shared if available, static otherwise 499 if(Geant4_shared_FOUND) 549 if(Geant4_shared_FOUND) 500 set(_geant4_lib_use_suffix "") 550 set(_geant4_lib_use_suffix "") 501 else() 551 else() 502 set(_geant4_lib_use_suffix "-static") 552 set(_geant4_lib_use_suffix "-static") 503 endif() 553 endif() 504 554 505 if(("static" IN_LIST Geant4_FIND_COMPONENTS) A 555 if(("static" IN_LIST Geant4_FIND_COMPONENTS) AND Geant4_static_FOUND) 506 set(_geant4_lib_use_suffix "-static") 556 set(_geant4_lib_use_suffix "-static") 507 endif() 557 endif() 508 558 509 # The list of libraries probably should be aut 559 # The list of libraries probably should be autogenerated, but we hard code 510 # for now. We don't have to divide the list of 560 # for now. We don't have to divide the list of shared libraries, but we 511 # do so for consistency with the way we'll nee 561 # do so for consistency with the way we'll need to do it for static. 512 # - Always on Vis Components 562 # - Always on Vis Components 513 set(_geant4_internal_libraries 563 set(_geant4_internal_libraries 514 Geant4::G4Tree${_geant4_lib_use_suffix} 564 Geant4::G4Tree${_geant4_lib_use_suffix} 515 Geant4::G4FR${_geant4_lib_use_suffix} 565 Geant4::G4FR${_geant4_lib_use_suffix} 516 Geant4::G4GMocren${_geant4_lib_use_suffix} 566 Geant4::G4GMocren${_geant4_lib_use_suffix} 517 Geant4::G4visHepRep${_geant4_lib_use_suffix} 567 Geant4::G4visHepRep${_geant4_lib_use_suffix} 518 Geant4::G4RayTracer${_geant4_lib_use_suffix} 568 Geant4::G4RayTracer${_geant4_lib_use_suffix} 519 Geant4::G4VRML${_geant4_lib_use_suffix} 569 Geant4::G4VRML${_geant4_lib_use_suffix} 520 Geant4::G4ToolsSG${_geant4_lib_use_suffix}) << 570 ) 521 571 522 # - G4OpenGL if it's requested. 572 # - G4OpenGL if it's requested. 523 if(_geant4_use_opengl_library) 573 if(_geant4_use_opengl_library) 524 list(APPEND _geant4_internal_libraries Geant << 574 list(APPEND _geant4_internal_libraries 525 endif() << 575 Geant4::G4OpenGL${_geant4_lib_use_suffix} 526 << 576 Geant4::G4gl2ps${_geant4_lib_use_suffix} 527 # - Qt3D if it's requested. << 577 ) 528 if(_geant4_use_qt3D_library) << 578 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OPENGL) 529 list(APPEND _geant4_internal_libraries Geant << 530 endif() 579 endif() 531 580 532 # - G4OpenInventor if it's requested. 581 # - G4OpenInventor if it's requested. 533 if(_geant4_use_inventor_library) 582 if(_geant4_use_inventor_library) 534 list(APPEND _geant4_internal_libraries Geant << 583 list(APPEND _geant4_internal_libraries 535 endif() << 584 Geant4::G4OpenInventor${_geant4_lib_use_suffix} 536 << 585 ) 537 if(_geant4_use_vtk_library) << 538 list(APPEND _geant4_internal_libraries Geant << 539 endif() << 540 << 541 # - GDML always added for now as old G4persist << 542 if(Geant4_gdml_FOUND) << 543 set(_geant4_g4gdml_library Geant4::G4gdml${_ << 544 endif() 586 endif() 545 587 546 # - G3toG4 if it's requested 588 # - G3toG4 if it's requested 547 if(_geant4_use_g3tog4_library) 589 if(_geant4_use_g3tog4_library) 548 set(_geant4_g3tog4_library Geant4::G3toG4${_ 590 set(_geant4_g3tog4_library Geant4::G3toG4${_geant4_lib_use_suffix}) 549 endif() 591 endif() 550 592 >> 593 # - link to timemory library if activated >> 594 if(_geant4_use_timemory_library) >> 595 list(APPEND _geant4_internal_libraries ${timemory_LIBRARIES}) >> 596 endif() >> 597 >> 598 # - Factory registration mechanism in physics_lists requires whole >> 599 # archive to be linked when using static libs, so requires wrapping >> 600 # with suitable compiler dependent flags >> 601 # 2016-05-24: use an alternate means of forcing linking of references for >> 602 # static builds. --whole-archive never was implemented for _WIN32 >> 603 # (appears not to even be possible) >> 604 # In order re-implement whole-archive, switch Geant4_FORCE_WHOLE_ARCHIVE ON 551 set(_geant4_physicslists_library Geant4::G4phy 605 set(_geant4_physicslists_library Geant4::G4physicslists${_geant4_lib_use_suffix}) 552 606 >> 607 set(Geant4_FORCE_WHOLE_ARCHIVE OFF) >> 608 if( Geant4_FORCE_WHOLE_ARCHIVE ) >> 609 if(_geant4_lib_use_suffix STREQUAL "-static") >> 610 # - Use CMAKE_CXX_COMPILER_ID, which should be reliable enough... >> 611 # Though the GNU/Clang/Intel compilers/linkers *should* use identical >> 612 # flags,keep their sections separate until behaviour confirmed >> 613 # >> 614 if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") >> 615 set(_geant4_physicslists_library -Wl,--whole-archive Geant4::G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive) >> 616 elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") >> 617 set(_geant4_physicslists_library -Wl,-force_load Geant4::G4physicslists${_geant4_lib_use_suffix}) >> 618 elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") >> 619 set(_geant4_physicslists_library -Wl,--whole-archive Geant4::G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive) >> 620 else() >> 621 # Needs determination of other compiler options. >> 622 # NB: MSVC has /OPT:NOREF, but may apply globally... >> 623 # reading up on this ... doesn't seem that it applies for subtle reasons >> 624 # only real way is to actually reference the static variables >> 625 set(_geant4_physicslists_library Geant4::G4physicslists${_geant4_lib_use_suffix}) >> 626 endif() >> 627 endif() >> 628 endif() >> 629 553 # - 'Kernel' libraries 630 # - 'Kernel' libraries 554 list(APPEND _geant4_internal_libraries 631 list(APPEND _geant4_internal_libraries 555 Geant4::G4vis_management${_geant4_lib_use_su 632 Geant4::G4vis_management${_geant4_lib_use_suffix} 556 Geant4::G4modeling${_geant4_lib_use_suffix} 633 Geant4::G4modeling${_geant4_lib_use_suffix} 557 Geant4::G4interfaces${_geant4_lib_use_suffix 634 Geant4::G4interfaces${_geant4_lib_use_suffix} 558 Geant4::G4mctruth${_geant4_lib_use_suffix} << 635 Geant4::G4persistency${_geant4_lib_use_suffix} 559 Geant4::G4geomtext${_geant4_lib_use_suffix} << 560 ${_geant4_g4gdml_library} << 561 ${_geant4_g3tog4_library} 636 ${_geant4_g3tog4_library} 562 Geant4::G4analysis${_geant4_lib_use_suffix} 637 Geant4::G4analysis${_geant4_lib_use_suffix} 563 Geant4::G4error_propagation${_geant4_lib_use 638 Geant4::G4error_propagation${_geant4_lib_use_suffix} 564 Geant4::G4readout${_geant4_lib_use_suffix} 639 Geant4::G4readout${_geant4_lib_use_suffix} 565 ${_geant4_physicslists_library} 640 ${_geant4_physicslists_library} 566 Geant4::G4run${_geant4_lib_use_suffix} 641 Geant4::G4run${_geant4_lib_use_suffix} 567 Geant4::G4event${_geant4_lib_use_suffix} 642 Geant4::G4event${_geant4_lib_use_suffix} 568 Geant4::G4tracking${_geant4_lib_use_suffix} 643 Geant4::G4tracking${_geant4_lib_use_suffix} 569 Geant4::G4parmodels${_geant4_lib_use_suffix} 644 Geant4::G4parmodels${_geant4_lib_use_suffix} 570 Geant4::G4processes${_geant4_lib_use_suffix} 645 Geant4::G4processes${_geant4_lib_use_suffix} 571 Geant4::G4digits_hits${_geant4_lib_use_suffi 646 Geant4::G4digits_hits${_geant4_lib_use_suffix} 572 Geant4::G4track${_geant4_lib_use_suffix} 647 Geant4::G4track${_geant4_lib_use_suffix} 573 Geant4::G4particles${_geant4_lib_use_suffix} 648 Geant4::G4particles${_geant4_lib_use_suffix} 574 Geant4::G4geometry${_geant4_lib_use_suffix} 649 Geant4::G4geometry${_geant4_lib_use_suffix} 575 Geant4::G4materials${_geant4_lib_use_suffix} 650 Geant4::G4materials${_geant4_lib_use_suffix} 576 Geant4::G4graphics_reps${_geant4_lib_use_suf 651 Geant4::G4graphics_reps${_geant4_lib_use_suffix} 577 Geant4::G4intercoms${_geant4_lib_use_suffix} 652 Geant4::G4intercoms${_geant4_lib_use_suffix} 578 Geant4::G4global${_geant4_lib_use_suffix} 653 Geant4::G4global${_geant4_lib_use_suffix} 579 # G4tools is INTERFACE, so same for both sta << 580 Geant4::G4tools << 581 ) 654 ) 582 655 583 # - Any externals built by Geant4 656 # - Any externals built by Geant4 584 foreach(_extlib @GEANT4_EXTERNALS_TARGETS@) 657 foreach(_extlib @GEANT4_EXTERNALS_TARGETS@) 585 list(APPEND 658 list(APPEND 586 _geant4_internal_libraries 659 _geant4_internal_libraries 587 Geant4::${_extlib}${_geant4_lib_use_suffix 660 Geant4::${_extlib}${_geant4_lib_use_suffix} 588 ) 661 ) 589 endforeach() 662 endforeach() 590 663 591 # - Now set them to Geant4_LIBRARIES 664 # - Now set them to Geant4_LIBRARIES 592 set(Geant4_LIBRARIES ${_geant4_internal_librar 665 set(Geant4_LIBRARIES ${_geant4_internal_libraries}) 593 666 594 #--------------------------------------------- 667 #----------------------------------------------------------------------- 595 # Remove any duplicates from the Geant4_{INCLU << 668 # Remove any duplicates from the Geant4_{DEFINITIONS,INCLUDE_DIRS,LIBRARIES} 596 # variables so that multiple passes append thi 669 # variables so that multiple passes append things correctly 597 # 670 # >> 671 if(Geant4_DEFINITIONS) >> 672 list(REMOVE_DUPLICATES Geant4_DEFINITIONS) >> 673 endif() >> 674 # - Create an interface target to export the selected definitions as >> 675 # usage requirements >> 676 if(NOT TARGET Geant4::G4UIVisDefinitions) >> 677 add_library(Geant4::G4UIVisDefinitions INTERFACE IMPORTED) >> 678 endif() >> 679 string(REGEX REPLACE "^\-D|;-D" ";" G4UIVIS_COMPILE_DEFINITIONS "${Geant4_DEFINITIONS}") >> 680 set_target_properties(Geant4::G4UIVisDefinitions PROPERTIES >> 681 INTERFACE_COMPILE_DEFINITIONS "${G4UIVIS_COMPILE_DEFINITIONS}") >> 682 unset(G4UIVIS_COMPILE_DEFINITIONS) >> 683 >> 684 list(APPEND Geant4_LIBRARIES Geant4::G4UIVisDefinitions) >> 685 598 if(Geant4_INCLUDE_DIRS) 686 if(Geant4_INCLUDE_DIRS) 599 list(REMOVE_DUPLICATES Geant4_INCLUDE_DIRS) 687 list(REMOVE_DUPLICATES Geant4_INCLUDE_DIRS) 600 endif() 688 endif() 601 689 602 if(Geant4_LIBRARIES) 690 if(Geant4_LIBRARIES) 603 list(REMOVE_DUPLICATES Geant4_LIBRARIES) 691 list(REMOVE_DUPLICATES Geant4_LIBRARIES) 604 endif() 692 endif() 605 693 606 #--------------------------------------------- 694 #----------------------------------------------------------------------- 607 # Point the user to the UseGeant4.cmake file w 695 # Point the user to the UseGeant4.cmake file which they may wish to include 608 # to help them with setting up Geant4 696 # to help them with setting up Geant4 609 # 697 # 610 set(Geant4_USE_FILE "${_geant4_thisdir}/UseGea 698 set(Geant4_USE_FILE "${_geant4_thisdir}/UseGeant4.cmake") 611 699 612 #--------------------------------------------- 700 #----------------------------------------------------------------------- 613 # Pop our custom module path from the CMake on 701 # Pop our custom module path from the CMake one 614 list(REMOVE_AT CMAKE_MODULE_PATH 0) 702 list(REMOVE_AT CMAKE_MODULE_PATH 0) 615 703 616 #--------------------------------------------- 704 #----------------------------------------------------------------------- 617 # Check FOUNDness of required components. << 705 # Finally, check FOUNDness of required components. 618 foreach(_comp ${Geant4_FIND_COMPONENTS}) 706 foreach(_comp ${Geant4_FIND_COMPONENTS}) 619 if(NOT Geant4_${_comp}_FOUND) 707 if(NOT Geant4_${_comp}_FOUND) 620 if(Geant4_FIND_REQUIRED_${_comp}) 708 if(Geant4_FIND_REQUIRED_${_comp}) 621 message(WARNING "Geant4 required compone 709 message(WARNING "Geant4 required component '${_comp}' not found") 622 set(Geant4_FOUND FALSE) 710 set(Geant4_FOUND FALSE) 623 endif() 711 endif() 624 endif() 712 endif() 625 endforeach() 713 endforeach() 626 714 627 #--------------------------------------------- << 715 # And we should be done... 628 # Reporting via FindPackageHandleStandardArgs << 716 629 include(FindPackageHandleStandardArgs) << 630 set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE << 631 find_package_handle_standard_args(@PROJECT_NAM <<