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