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) 260 else() 252 else() 261 set(Geant4_builtin_clhep_FOUND TRUE) 253 set(Geant4_builtin_clhep_FOUND TRUE) 262 endif() 254 endif() 263 255 264 # - EXPAT << 265 set(Geant4_builtin_expat_FOUND @GEANT4_USE_BUI 256 set(Geant4_builtin_expat_FOUND @GEANT4_USE_BUILTIN_EXPAT@) 266 if(NOT Geant4_builtin_expat_FOUND) 257 if(NOT Geant4_builtin_expat_FOUND) 267 find_dependency(EXPAT @EXPAT_VERSION_STRING@ 258 find_dependency(EXPAT @EXPAT_VERSION_STRING@) 268 include("${CMAKE_CURRENT_LIST_DIR}/G4EXPATSh 259 include("${CMAKE_CURRENT_LIST_DIR}/G4EXPATShim.cmake") 269 endif() 260 endif() 270 261 271 # - ZLIB << 272 set(Geant4_builtin_zlib_FOUND @GEANT4_USE_BUIL 262 set(Geant4_builtin_zlib_FOUND @GEANT4_USE_BUILTIN_ZLIB@) 273 if(NOT Geant4_builtin_zlib_FOUND) 263 if(NOT Geant4_builtin_zlib_FOUND) 274 find_dependency(ZLIB @ZLIB_VERSION_STRING@) 264 find_dependency(ZLIB @ZLIB_VERSION_STRING@) 275 endif() 265 endif() 276 266 277 # - PTL/TBB << 278 set(Geant4_system_ptl_FOUND @GEANT4_USE_SYSTEM 267 set(Geant4_system_ptl_FOUND @GEANT4_USE_SYSTEM_PTL@) 279 set(Geant4_TBB_FOUND @GEANT4_USE_TBB@) << 280 if(Geant4_system_ptl_FOUND) 268 if(Geant4_system_ptl_FOUND) 281 set(Geant4_builtin_ptl_FOUND FALSE) 269 set(Geant4_builtin_ptl_FOUND FALSE) 282 if(Geant4_TBB_FOUND) << 270 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() 271 else() 288 # We know exactly where PTL is 272 # We know exactly where PTL is 289 set(Geant4_builtin_ptl_FOUND TRUE) 273 set(Geant4_builtin_ptl_FOUND TRUE) 290 if(CMAKE_VERSION VERSION_GREATER 3.8.9999) 274 if(CMAKE_VERSION VERSION_GREATER 3.8.9999) 291 find_dependency(PTL NO_DEFAULT_PATH PATHS << 275 find_dependency(PTL @PTL_VERSION_STRING@ NO_DEFAULT_PATH PATHS "@PACKAGE_PTL_PREFIX@") 292 else() 276 else() 293 find_package(PTL REQUIRED NO_DEFAULT_PATH << 277 find_package(PTL @PTL_VERSION_STRING@ REQUIRED NO_DEFAULT_PATH PATHS "@PACKAGE_PTL_PREFIX@") >> 278 endif() >> 279 endif() >> 280 >> 281 # - Multithreading >> 282 set(Geant4_multithreaded_FOUND @GEANT4_BUILD_MULTITHREADED@) >> 283 if(Geant4_multithreaded_FOUND) >> 284 # - Define variable to indicate TLS model used >> 285 set(Geant4_TLS_MODEL "@GEANT4_BUILD_TLS_MODEL@") >> 286 if(Geant4_TLS_MODEL STREQUAL "auto") >> 287 unset(Geant4_TLS_MODEL) 294 endif() 288 endif() 295 endif() 289 endif() 296 290 297 # - GDML 291 # - GDML 298 set(Geant4_gdml_FOUND @GEANT4_USE_GDML@) 292 set(Geant4_gdml_FOUND @GEANT4_USE_GDML@) 299 if(Geant4_gdml_FOUND) 293 if(Geant4_gdml_FOUND) 300 find_dependency(XercesC @XercesC_VERSION@) 294 find_dependency(XercesC @XercesC_VERSION@) 301 endif() 295 endif() 302 296 >> 297 # - Smart track stack >> 298 set(Geant4_smartstack_FOUND @GEANT4_USE_SMARTSTACK@) >> 299 >> 300 # - ParticleHP as HP >> 301 set(Geant4_php_as_hp_FOUND @GEANT4_BUILD_PHP_AS_HP@) >> 302 >> 303 # - TBB >> 304 set(Geant4_TBB_FOUND @GEANT4_USE_TBB@) >> 305 if(Geant4_TBB_FOUND) >> 306 find_dependency(TBB @TBB_VERSION@) >> 307 endif() >> 308 >> 309 # - TiMemory >> 310 set(Geant4_timemory_FOUND @GEANT4_USE_TIMEMORY@) >> 311 if(Geant4_timemory_FOUND) >> 312 set(_geant4_use_timemory_library ON) >> 313 set(timemory_DIR "@timemory_DIR@" CACHE PATH "timemory installation for Geant4") >> 314 if(NOT TARGET @timemory_FIND_COMPONENTS_INTERFACE@) >> 315 add_library(@timemory_FIND_COMPONENTS_INTERFACE@ INTERFACE IMPORTED) >> 316 set(timemory_FIND_COMPONENTS_INTERFACE @timemory_FIND_COMPONENTS_INTERFACE@) >> 317 find_package(timemory @G4timemory_VERSION@ REQUIRED QUIET >> 318 COMPONENTS @G4timemory_COMPONENTS@) >> 319 endif() >> 320 set(timemory_LIBRARIES @timemory_FIND_COMPONENTS_INTERFACE@) >> 321 endif() >> 322 >> 323 # - G3toG4 >> 324 set(Geant4_g3tog4_FOUND @GEANT4_USE_G3TOG4@) >> 325 if(Geant4_g3tog4_FOUND) >> 326 if(Geant4_FIND_REQUIRED_g3tog4) >> 327 set(_geant4_use_g3tog4_library ON) >> 328 endif() >> 329 endif() >> 330 303 # - VecGeom 331 # - VecGeom 304 set(Geant4_usolids_FOUND @GEANT4_USE_USOLIDS_E 332 set(Geant4_usolids_FOUND @GEANT4_USE_USOLIDS_EITHER@) 305 if(Geant4_usolids_FOUND) 333 if(Geant4_usolids_FOUND) 306 find_dependency(VecGeom @VecGeom_VERSION@) 334 find_dependency(VecGeom @VecGeom_VERSION@) >> 335 include("${CMAKE_CURRENT_LIST_DIR}/G4VecGeomShim.cmake") 307 endif() 336 endif() 308 337 309 # - Freetype 338 # - Freetype 310 set(Geant4_freetype_FOUND @GEANT4_USE_FREETYPE 339 set(Geant4_freetype_FOUND @GEANT4_USE_FREETYPE@) 311 if(Geant4_freetype_FOUND) 340 if(Geant4_freetype_FOUND) 312 find_dependency(Freetype @FREETYPE_VERSION_S 341 find_dependency(Freetype @FREETYPE_VERSION_STRING@) 313 include("${CMAKE_CURRENT_LIST_DIR}/G4Freetyp 342 include("${CMAKE_CURRENT_LIST_DIR}/G4FreetypeShim.cmake") 314 endif() 343 endif() 315 344 316 # - HDF5 345 # - HDF5 317 set(Geant4_hdf5_FOUND @GEANT4_USE_HDF5@) 346 set(Geant4_hdf5_FOUND @GEANT4_USE_HDF5@) 318 if(Geant4_hdf5_FOUND) 347 if(Geant4_hdf5_FOUND) 319 find_dependency(HDF5) << 348 find_dependency(HDF5 @HDF5_VERSION@) 320 include("${CMAKE_CURRENT_LIST_DIR}/G4HDF5Shi 349 include("${CMAKE_CURRENT_LIST_DIR}/G4HDF5Shim.cmake") 321 endif() 350 endif() 322 351 323 #--------------------------------------------- 352 #----------------------------------------------------------------------- 324 # UI/VIS 353 # UI/VIS 325 # 354 # 326 # Prefer Legacy GL when using CMake >= 3.10 355 # Prefer Legacy GL when using CMake >= 3.10 327 set(OpenGL_GL_PREFERENCE_SAVE "${OpenGL_GL_PRE 356 set(OpenGL_GL_PREFERENCE_SAVE "${OpenGL_GL_PREFERENCE}") 328 set(OpenGL_GL_PREFERENCE "LEGACY") 357 set(OpenGL_GL_PREFERENCE "LEGACY") 329 358 330 # - Helper variables for ui/vis_all components 359 # - Helper variables for ui/vis_all components 331 if("ui_all" IN_LIST Geant4_FIND_COMPONENTS) 360 if("ui_all" IN_LIST Geant4_FIND_COMPONENTS) 332 set(Geant4_ui_all_FOUND TRUE) 361 set(Geant4_ui_all_FOUND TRUE) 333 endif() 362 endif() 334 363 335 if("vis_all" IN_LIST Geant4_FIND_COMPONENTS) 364 if("vis_all" IN_LIST Geant4_FIND_COMPONENTS) 336 set(Geant4_vis_all_FOUND TRUE) 365 set(Geant4_vis_all_FOUND TRUE) 337 endif() 366 endif() 338 367 339 # - UI : TCSH 368 # - UI : TCSH 340 set(Geant4_ui_tcsh_FOUND @UNIX@) 369 set(Geant4_ui_tcsh_FOUND @UNIX@) >> 370 if(Geant4_ui_tcsh_FOUND) >> 371 if(("ui_tcsh" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND) >> 372 list(APPEND Geant4_DEFINITIONS -DG4UI_USE_TCSH) >> 373 endif() >> 374 endif() 341 375 342 # - UI : win32 376 # - UI : win32 343 set(Geant4_ui_win32_FOUND @WIN32@) 377 set(Geant4_ui_win32_FOUND @WIN32@) >> 378 if(Geant4_ui_win32_FOUND) >> 379 if(("ui_win32" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_ui_all_FOUND) >> 380 list(APPEND Geant4_DEFINITIONS -DG4UI_USE_WIN32) >> 381 endif() >> 382 endif() 344 383 345 #--------------------------------------------- 384 #----------------------------------------------------------------------- 346 # Components which requires slightly more comp 385 # Components which requires slightly more complex setup 347 # 386 # 348 # - Visualization : RayTracerX 387 # - Visualization : RayTracerX 349 set(Geant4_vis_raytracer_x11_FOUND @GEANT4_USE 388 set(Geant4_vis_raytracer_x11_FOUND @GEANT4_USE_RAYTRACER_X11@) 350 if(Geant4_vis_raytracer_x11_FOUND) 389 if(Geant4_vis_raytracer_x11_FOUND) 351 find_dependency(X11) 390 find_dependency(X11) 352 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim 391 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake") >> 392 >> 393 if(("vis_raytracer_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 394 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_RAYTRACERX) >> 395 endif() 353 endif() 396 endif() 354 397 355 # - Qt (UI and Vis!) 398 # - Qt (UI and Vis!) 356 set(Geant4_qt_FOUND @GEANT4_USE_QT@) 399 set(Geant4_qt_FOUND @GEANT4_USE_QT@) 357 set(Geant4_qt3d_FOUND @GEANT4_USE_QT3D@) 400 set(Geant4_qt3d_FOUND @GEANT4_USE_QT3D@) 358 if(Geant4_qt_FOUND) 401 if(Geant4_qt_FOUND) 359 # Must always refind Qt to recreate imported << 402 # Must always refind Qt5 to recreate imported targets. Because these 360 # are in the public interface, always need l 403 # are in the public interface, always need linking. 361 find_dependency(Qt@QT_VERSION_MAJOR@Core REQ << 404 find_dependency(Qt5Core REQUIRED) 362 find_dependency(Qt@QT_VERSION_MAJOR@Gui REQU << 405 find_dependency(Qt5Gui REQUIRED) 363 find_dependency(Qt@QT_VERSION_MAJOR@Widgets << 406 find_dependency(Qt5Widgets REQUIRED) 364 find_dependency(Qt@QT_VERSION_MAJOR@OpenGL R << 407 find_dependency(Qt5OpenGL REQUIRED) 365 if(@QT_VERSION_MAJOR@ GREATER 5) << 408 find_dependency(Qt5PrintSupport REQUIRED) 366 find_dependency(Qt@QT_VERSION_MAJOR@OpenGL << 367 endif() << 368 409 369 if(Geant4_qt3d_FOUND) 410 if(Geant4_qt3d_FOUND) 370 find_dependency(Qt@QT_VERSION_MAJOR@3DCore << 411 find_dependency(Qt53DCore @QT3D_MINIMUM_VERSION@ REQUIRED) 371 find_dependency(Qt@QT_VERSION_MAJOR@3DExtr << 412 find_dependency(Qt53DExtras @QT3D_MINIMUM_VERSION@ REQUIRED) 372 find_dependency(Qt@QT_VERSION_MAJOR@3DRend << 413 find_dependency(Qt53DRender @QT3D_MINIMUM_VERSION@ REQUIRED) 373 endif() 414 endif() 374 415 375 # Also require OpenGL 416 # Also require OpenGL 376 find_dependency(OpenGL) 417 find_dependency(OpenGL) 377 418 378 # Qt must be activated both directly and for 419 # Qt must be activated both directly and for OpenInventor 379 if(("qt" IN_LIST Geant4_FIND_COMPONENTS) 420 if(("qt" IN_LIST Geant4_FIND_COMPONENTS) 380 OR ("vis_openinventor" IN_LIST Geant4_FIN 421 OR ("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS) >> 422 OR ("vis_toolssg_qt_gles" IN_LIST Geant4_FIND_COMPONENTS) 381 OR Geant4_ui_all_FOUND OR Geant4_vis_all_ 423 OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND) >> 424 list(APPEND Geant4_DEFINITIONS -DG4UI_USE_QT -DG4VIS_USE_OPENGLQT) 382 set(_geant4_use_opengl_library ON) 425 set(_geant4_use_opengl_library ON) 383 # Qt3D is always on if available 426 # Qt3D is always on if available 384 set(_geant4_use_qt3D_library ${Geant4_qt3d 427 set(_geant4_use_qt3D_library ${Geant4_qt3d_FOUND}) 385 endif() 428 endif() 386 endif() 429 endif() 387 430 388 # - Motif (UI and Vis!) 431 # - Motif (UI and Vis!) 389 set(Geant4_motif_FOUND @GEANT4_USE_XM@) 432 set(Geant4_motif_FOUND @GEANT4_USE_XM@) 390 if(Geant4_motif_FOUND) 433 if(Geant4_motif_FOUND) 391 find_dependency(X11) 434 find_dependency(X11) 392 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim 435 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake") 393 find_dependency(Motif) 436 find_dependency(Motif) 394 include("${CMAKE_CURRENT_LIST_DIR}/G4MotifSh 437 include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake") 395 if(APPLE) 438 if(APPLE) 396 find_dependency(XQuartzGL) 439 find_dependency(XQuartzGL) 397 else() 440 else() 398 find_dependency(OpenGL) 441 find_dependency(OpenGL) 399 endif() 442 endif() 400 443 401 # Motif can be activated both directly and f 444 # Motif can be activated both directly and for OpenInventor 402 if(("motif" IN_LIST Geant4_FIND_COMPONENTS) 445 if(("motif" IN_LIST Geant4_FIND_COMPONENTS) 403 OR ("vis_openinventor" IN_LIST Geant4_FIN 446 OR ("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS) >> 447 OR ("vis_toolssg_xt_gles" IN_LIST Geant4_FIND_COMPONENTS) 404 OR Geant4_ui_all_FOUND OR Geant4_vis_all_ 448 OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND) >> 449 list(APPEND Geant4_DEFINITIONS -DG4UI_USE_XM -DG4VIS_USE_OPENGLXM) 405 set(_geant4_use_opengl_library ON) 450 set(_geant4_use_opengl_library ON) 406 endif() 451 endif() 407 endif() 452 endif() 408 453 409 # - OpenGL X11 454 # - OpenGL X11 410 set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OP 455 set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OPENGL_X11@) 411 if(Geant4_vis_opengl_x11_FOUND) 456 if(Geant4_vis_opengl_x11_FOUND) 412 find_dependency(X11) 457 find_dependency(X11) 413 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim 458 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake") 414 if(APPLE) 459 if(APPLE) 415 find_dependency(XQuartzGL) 460 find_dependency(XQuartzGL) 416 else() 461 else() 417 find_dependency(OpenGL) 462 find_dependency(OpenGL) 418 endif() 463 endif() 419 464 420 if(("vis_opengl_x11" IN_LIST Geant4_FIND_COM 465 if(("vis_opengl_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 466 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OPENGLX) 421 set(_geant4_use_opengl_library ON) 467 set(_geant4_use_opengl_library ON) 422 endif() 468 endif() 423 endif() 469 endif() 424 470 425 # - OpenGL Win32 471 # - OpenGL Win32 426 set(Geant4_vis_opengl_win32_FOUND @GEANT4_USE_ 472 set(Geant4_vis_opengl_win32_FOUND @GEANT4_USE_OPENGL_WIN32@) 427 if(Geant4_vis_opengl_win32_FOUND) 473 if(Geant4_vis_opengl_win32_FOUND) 428 find_dependency(OpenGL) 474 find_dependency(OpenGL) 429 if(("vis_opengl_win32" IN_LIST Geant4_FIND_C 475 if(("vis_opengl_win32" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 476 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OPENGLWIN32) 430 set(_geant4_use_opengl_library ON) 477 set(_geant4_use_opengl_library ON) 431 endif() 478 endif() 432 endif() 479 endif() 433 480 434 # - OpenInventor 481 # - OpenInventor 435 set(Geant4_vis_openinventor_FOUND @GEANT4_USE_ 482 set(Geant4_vis_openinventor_FOUND @GEANT4_USE_INVENTOR@) 436 set(Geant4_vis_openinventor_qt_FOUND @GEANT4_U 483 set(Geant4_vis_openinventor_qt_FOUND @GEANT4_USE_INVENTOR_QT@) 437 if(Geant4_vis_openinventor_FOUND) 484 if(Geant4_vis_openinventor_FOUND) 438 find_dependency(Coin) 485 find_dependency(Coin) 439 486 440 if(Geant4_vis_openinventor_qt_FOUND) 487 if(Geant4_vis_openinventor_qt_FOUND) 441 # Qt dependency handled by Geant4_vis_qt_F 488 # Qt dependency handled by Geant4_vis_qt_FOUND earlier, 442 # always ON if Inventor_QT is 489 # always ON if Inventor_QT is 443 find_dependency(SoQt) 490 find_dependency(SoQt) 444 else() 491 else() 445 if(WIN32) 492 if(WIN32) 446 find_dependency(SoWin) 493 find_dependency(SoWin) 447 else() 494 else() 448 # Motif/X11/GL dependency handled by Gea 495 # Motif/X11/GL dependency handled by Geant4_motif_FOUND earlier, 449 # always ON if Inventor/Xt is. 496 # always ON if Inventor/Xt is. 450 find_dependency(SoXt) 497 find_dependency(SoXt) 451 endif() 498 endif() 452 endif() 499 endif() 453 500 454 if(("vis_openinventor" IN_LIST Geant4_FIND_C 501 if(("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 502 if(Geant4_vis_openinventor_qt_FOUND) >> 503 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OI -DG4VIS_USE_OIQT) >> 504 else() >> 505 if(WIN32) >> 506 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OI -DG4VIS_USE_OIWIN32) >> 507 else() >> 508 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OI -DG4VIS_USE_OIX) >> 509 endif() >> 510 endif() >> 511 455 set(_geant4_use_inventor_library ON) 512 set(_geant4_use_inventor_library ON) 456 endif() 513 endif() 457 endif() 514 endif() 458 515 >> 516 # - ToolsSG X11/GLES >> 517 set(Geant4_vis_toolssg_x11_gles_FOUND @GEANT4_USE_TOOLSSG_X11_GLES@) >> 518 if(Geant4_vis_toolssg_x11_gles_FOUND) >> 519 find_dependency(X11) >> 520 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake") >> 521 if(APPLE) >> 522 find_dependency(XQuartzGL) >> 523 else() >> 524 find_dependency(OpenGL) >> 525 endif() >> 526 >> 527 if(("vis_toolssg_x11_gles" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 528 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_TOOLSSG_X11_GLES) >> 529 set(_geant4_use_toolssg_library ON) >> 530 endif() >> 531 endif() >> 532 >> 533 # - ToolsSG Windows/GLES >> 534 set(Geant4_vis_toolssg_windows_gles_FOUND @GEANT4_USE_TOOLSSG_WINDOWS_GLES@) >> 535 if(Geant4_vis_toolssg_windows_gles_FOUND) >> 536 find_dependency(OpenGL) >> 537 if(("vis_toolssg_windows_gles" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 538 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_TOOLSSG_WINDOWS_GLES) >> 539 set(_geant4_use_toolssg_library ON) >> 540 endif() >> 541 endif() >> 542 >> 543 # - ToolsSG Xt/GLES >> 544 set(Geant4_vis_toolssg_xt_gles_FOUND @GEANT4_USE_TOOLSSG_XT_GLES@) >> 545 if(Geant4_vis_toolssg_xt_gles_FOUND) >> 546 find_dependency(X11) >> 547 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake") >> 548 if(APPLE) >> 549 find_dependency(XQuartzGL) >> 550 else() >> 551 find_dependency(OpenGL) >> 552 endif() >> 553 >> 554 if(("vis_toolssg_xt_gles" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 555 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_TOOLSSG_XT_GLES) >> 556 set(_geant4_use_toolssg_library ON) >> 557 endif() >> 558 endif() >> 559 >> 560 # - ToolsSG Qt/GLES >> 561 set(Geant4_vis_toolssg_qt_gles_FOUND @GEANT4_USE_TOOLSSG_QT_GLES@) >> 562 if(Geant4_vis_toolssg_qt_gles_FOUND) >> 563 find_dependency(OpenGL) >> 564 if(("vis_toolssg_qt_gles" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND) >> 565 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_TOOLSSG_QT_GLES) >> 566 set(_geant4_use_toolssg_library ON) >> 567 endif() >> 568 endif() >> 569 459 # Reset any OpenGL Preference 570 # Reset any OpenGL Preference 460 set(OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFEREN 571 set(OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFERENCE_SAVE}") 461 572 462 set(Geant4_vis_Vtk_FOUND @GEANT4_USE_VTK@) 573 set(Geant4_vis_Vtk_FOUND @GEANT4_USE_VTK@) 463 if(Geant4_vis_Vtk_FOUND) 574 if(Geant4_vis_Vtk_FOUND) 464 find_dependency(VTK 9 REQUIRED COMPONENTS << 575 find_dependency(VTK) 465 CommonColor << 576 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_VTK) 466 InteractionStyle << 467 IOExport << 468 GUISupportQt << 469 RenderingVolumeOpenGL2 << 470 ) << 471 set(_geant4_use_vtk_library ON) 577 set(_geant4_use_vtk_library ON) >> 578 >> 579 if(Geant4_qt_FOUND) >> 580 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_VTK_QT) >> 581 endif() 472 endif() 582 endif() 473 583 474 #--------------------------------------------- 584 #----------------------------------------------------------------------- 475 # Include the files listing all the imported t 585 # Include the files listing all the imported targets and configuring 476 # Intel/MSVC Compile Features 586 # Intel/MSVC Compile Features 477 # (Not needed if used in the same Geant4 proje 587 # (Not needed if used in the same Geant4 project, or if we have run before) 478 # This is always installed in the same locatio 588 # This is always installed in the same location as us... 479 # 589 # 480 if(NOT CMAKE_PROJECT_NAME STREQUAL Geant4) 590 if(NOT CMAKE_PROJECT_NAME STREQUAL Geant4) 481 include("${_geant4_thisdir}/Modules/IntelCom 591 include("${_geant4_thisdir}/Modules/IntelCompileFeatures.cmake") 482 include("${_geant4_thisdir}/Modules/MSVCComp 592 include("${_geant4_thisdir}/Modules/MSVCCompileFeatures.cmake") 483 593 484 if(NOT Geant4_LIBDEPS_LOADED) 594 if(NOT Geant4_LIBDEPS_LOADED) 485 include("${_geant4_thisdir}/Geant4LibraryD 595 include("${_geant4_thisdir}/Geant4LibraryDepends.cmake") 486 set(Geant4_LIBDEPS_LOADED 1) 596 set(Geant4_LIBDEPS_LOADED 1) 487 endif() 597 endif() 488 endif() 598 endif() 489 599 490 #--------------------------------------------- 600 #----------------------------------------------------------------------- 491 # Now perform final configuration of libraries 601 # Now perform final configuration of libraries... 492 # We provide FOUND variables for presence of s 602 # We provide FOUND variables for presence of shared and static 493 # User can supply "static" component to force 603 # User can supply "static" component to force use of static libraries, if 494 # available. 604 # available. 495 set(Geant4_shared_FOUND @BUILD_SHARED_LIBS@) 605 set(Geant4_shared_FOUND @BUILD_SHARED_LIBS@) 496 set(Geant4_static_FOUND @BUILD_STATIC_LIBS@) 606 set(Geant4_static_FOUND @BUILD_STATIC_LIBS@) 497 607 498 # - Default setting : shared if available, sta 608 # - Default setting : shared if available, static otherwise 499 if(Geant4_shared_FOUND) 609 if(Geant4_shared_FOUND) 500 set(_geant4_lib_use_suffix "") 610 set(_geant4_lib_use_suffix "") 501 else() 611 else() 502 set(_geant4_lib_use_suffix "-static") 612 set(_geant4_lib_use_suffix "-static") 503 endif() 613 endif() 504 614 505 if(("static" IN_LIST Geant4_FIND_COMPONENTS) A 615 if(("static" IN_LIST Geant4_FIND_COMPONENTS) AND Geant4_static_FOUND) 506 set(_geant4_lib_use_suffix "-static") 616 set(_geant4_lib_use_suffix "-static") 507 endif() 617 endif() 508 618 509 # The list of libraries probably should be aut 619 # The list of libraries probably should be autogenerated, but we hard code 510 # for now. We don't have to divide the list of 620 # 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 621 # do so for consistency with the way we'll need to do it for static. 512 # - Always on Vis Components 622 # - Always on Vis Components 513 set(_geant4_internal_libraries 623 set(_geant4_internal_libraries 514 Geant4::G4Tree${_geant4_lib_use_suffix} 624 Geant4::G4Tree${_geant4_lib_use_suffix} 515 Geant4::G4FR${_geant4_lib_use_suffix} 625 Geant4::G4FR${_geant4_lib_use_suffix} 516 Geant4::G4GMocren${_geant4_lib_use_suffix} 626 Geant4::G4GMocren${_geant4_lib_use_suffix} 517 Geant4::G4visHepRep${_geant4_lib_use_suffix} 627 Geant4::G4visHepRep${_geant4_lib_use_suffix} 518 Geant4::G4RayTracer${_geant4_lib_use_suffix} 628 Geant4::G4RayTracer${_geant4_lib_use_suffix} 519 Geant4::G4VRML${_geant4_lib_use_suffix} << 629 Geant4::G4VRML${_geant4_lib_use_suffix}) 520 Geant4::G4ToolsSG${_geant4_lib_use_suffix}) << 521 630 522 # - G4OpenGL if it's requested. 631 # - G4OpenGL if it's requested. 523 if(_geant4_use_opengl_library) 632 if(_geant4_use_opengl_library) 524 list(APPEND _geant4_internal_libraries Geant << 633 list(APPEND _geant4_internal_libraries >> 634 Geant4::G4OpenGL${_geant4_lib_use_suffix} >> 635 Geant4::G4gl2ps${_geant4_lib_use_suffix}) >> 636 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OPENGL) 525 endif() 637 endif() 526 638 527 # - Qt3D if it's requested. 639 # - Qt3D if it's requested. 528 if(_geant4_use_qt3D_library) 640 if(_geant4_use_qt3D_library) 529 list(APPEND _geant4_internal_libraries Geant 641 list(APPEND _geant4_internal_libraries Geant4::G4visQt3D${_geant4_lib_use_suffix}) >> 642 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_QT3D) 530 endif() 643 endif() 531 644 532 # - G4OpenInventor if it's requested. 645 # - G4OpenInventor if it's requested. 533 if(_geant4_use_inventor_library) 646 if(_geant4_use_inventor_library) 534 list(APPEND _geant4_internal_libraries Geant 647 list(APPEND _geant4_internal_libraries Geant4::G4OpenInventor${_geant4_lib_use_suffix}) 535 endif() 648 endif() 536 649 537 if(_geant4_use_vtk_library) << 650 # - G4ToolsSG if it's requested. 538 list(APPEND _geant4_internal_libraries Geant << 651 if(_geant4_use_toolssg_library) >> 652 list(APPEND _geant4_internal_libraries Geant4::G4ToolsSG${_geant4_lib_use_suffix}) >> 653 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_TOOLSSG) 539 endif() 654 endif() 540 655 541 # - GDML always added for now as old G4persist << 656 if(_geant4_use_vtk_library) 542 if(Geant4_gdml_FOUND) << 657 list(APPEND _geant4_internal_libraries Geant4::G4visVtk${_geant4_lib_use_suffix}) 543 set(_geant4_g4gdml_library Geant4::G4gdml${_ << 544 endif() 658 endif() 545 659 546 # - G3toG4 if it's requested 660 # - G3toG4 if it's requested 547 if(_geant4_use_g3tog4_library) 661 if(_geant4_use_g3tog4_library) 548 set(_geant4_g3tog4_library Geant4::G3toG4${_ 662 set(_geant4_g3tog4_library Geant4::G3toG4${_geant4_lib_use_suffix}) 549 endif() 663 endif() 550 664 >> 665 # - link to timemory library if activated >> 666 if(_geant4_use_timemory_library) >> 667 list(APPEND _geant4_internal_libraries ${timemory_LIBRARIES}) >> 668 endif() >> 669 >> 670 # - Factory registration mechanism in physics_lists requires whole >> 671 # archive to be linked when using static libs, so requires wrapping >> 672 # with suitable compiler dependent flags >> 673 # 2016-05-24: use an alternate means of forcing linking of references for >> 674 # static builds. --whole-archive never was implemented for _WIN32 >> 675 # (appears not to even be possible) >> 676 # In order re-implement whole-archive, switch Geant4_FORCE_WHOLE_ARCHIVE ON 551 set(_geant4_physicslists_library Geant4::G4phy 677 set(_geant4_physicslists_library Geant4::G4physicslists${_geant4_lib_use_suffix}) 552 678 >> 679 set(Geant4_FORCE_WHOLE_ARCHIVE OFF) >> 680 if( Geant4_FORCE_WHOLE_ARCHIVE ) >> 681 if(_geant4_lib_use_suffix STREQUAL "-static") >> 682 # - Use CMAKE_CXX_COMPILER_ID, which should be reliable enough... >> 683 # Though the GNU/Clang/Intel compilers/linkers *should* use identical >> 684 # flags,keep their sections separate until behaviour confirmed >> 685 # >> 686 if(CMAKE_CXX_COMPILER_ID MATCHES "GNU") >> 687 set(_geant4_physicslists_library -Wl,--whole-archive Geant4::G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive) >> 688 elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") >> 689 set(_geant4_physicslists_library -Wl,-force_load Geant4::G4physicslists${_geant4_lib_use_suffix}) >> 690 elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") >> 691 set(_geant4_physicslists_library -Wl,--whole-archive Geant4::G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive) >> 692 else() >> 693 # Needs determination of other compiler options. >> 694 # NB: MSVC has /OPT:NOREF, but may apply globally... >> 695 # reading up on this ... doesn't seem that it applies for subtle reasons >> 696 # only real way is to actually reference the static variables >> 697 set(_geant4_physicslists_library Geant4::G4physicslists${_geant4_lib_use_suffix}) >> 698 endif() >> 699 endif() >> 700 endif() >> 701 553 # - 'Kernel' libraries 702 # - 'Kernel' libraries 554 list(APPEND _geant4_internal_libraries 703 list(APPEND _geant4_internal_libraries 555 Geant4::G4vis_management${_geant4_lib_use_su 704 Geant4::G4vis_management${_geant4_lib_use_suffix} 556 Geant4::G4modeling${_geant4_lib_use_suffix} 705 Geant4::G4modeling${_geant4_lib_use_suffix} 557 Geant4::G4interfaces${_geant4_lib_use_suffix 706 Geant4::G4interfaces${_geant4_lib_use_suffix} 558 Geant4::G4mctruth${_geant4_lib_use_suffix} << 707 Geant4::G4persistency${_geant4_lib_use_suffix} 559 Geant4::G4geomtext${_geant4_lib_use_suffix} << 560 ${_geant4_g4gdml_library} << 561 ${_geant4_g3tog4_library} 708 ${_geant4_g3tog4_library} 562 Geant4::G4analysis${_geant4_lib_use_suffix} 709 Geant4::G4analysis${_geant4_lib_use_suffix} 563 Geant4::G4error_propagation${_geant4_lib_use 710 Geant4::G4error_propagation${_geant4_lib_use_suffix} 564 Geant4::G4readout${_geant4_lib_use_suffix} 711 Geant4::G4readout${_geant4_lib_use_suffix} 565 ${_geant4_physicslists_library} 712 ${_geant4_physicslists_library} 566 Geant4::G4run${_geant4_lib_use_suffix} 713 Geant4::G4run${_geant4_lib_use_suffix} 567 Geant4::G4event${_geant4_lib_use_suffix} 714 Geant4::G4event${_geant4_lib_use_suffix} >> 715 Geant4::G4tasking${_geant4_lib_use_suffix} 568 Geant4::G4tracking${_geant4_lib_use_suffix} 716 Geant4::G4tracking${_geant4_lib_use_suffix} 569 Geant4::G4parmodels${_geant4_lib_use_suffix} 717 Geant4::G4parmodels${_geant4_lib_use_suffix} 570 Geant4::G4processes${_geant4_lib_use_suffix} 718 Geant4::G4processes${_geant4_lib_use_suffix} 571 Geant4::G4digits_hits${_geant4_lib_use_suffi 719 Geant4::G4digits_hits${_geant4_lib_use_suffix} 572 Geant4::G4track${_geant4_lib_use_suffix} 720 Geant4::G4track${_geant4_lib_use_suffix} 573 Geant4::G4particles${_geant4_lib_use_suffix} 721 Geant4::G4particles${_geant4_lib_use_suffix} 574 Geant4::G4geometry${_geant4_lib_use_suffix} 722 Geant4::G4geometry${_geant4_lib_use_suffix} 575 Geant4::G4materials${_geant4_lib_use_suffix} 723 Geant4::G4materials${_geant4_lib_use_suffix} 576 Geant4::G4graphics_reps${_geant4_lib_use_suf 724 Geant4::G4graphics_reps${_geant4_lib_use_suffix} 577 Geant4::G4intercoms${_geant4_lib_use_suffix} 725 Geant4::G4intercoms${_geant4_lib_use_suffix} 578 Geant4::G4global${_geant4_lib_use_suffix} 726 Geant4::G4global${_geant4_lib_use_suffix} 579 # G4tools is INTERFACE, so same for both sta << 727 Geant4::G4tools${_geant4_lib_use_suffix} 580 Geant4::G4tools << 581 ) 728 ) 582 729 583 # - Any externals built by Geant4 730 # - Any externals built by Geant4 584 foreach(_extlib @GEANT4_EXTERNALS_TARGETS@) 731 foreach(_extlib @GEANT4_EXTERNALS_TARGETS@) 585 list(APPEND 732 list(APPEND 586 _geant4_internal_libraries 733 _geant4_internal_libraries 587 Geant4::${_extlib}${_geant4_lib_use_suffix 734 Geant4::${_extlib}${_geant4_lib_use_suffix} 588 ) 735 ) 589 endforeach() 736 endforeach() 590 737 591 # - Now set them to Geant4_LIBRARIES 738 # - Now set them to Geant4_LIBRARIES 592 set(Geant4_LIBRARIES ${_geant4_internal_librar 739 set(Geant4_LIBRARIES ${_geant4_internal_libraries}) 593 740 594 #--------------------------------------------- 741 #----------------------------------------------------------------------- 595 # Remove any duplicates from the Geant4_{INCLU << 742 # Remove any duplicates from the Geant4_{DEFINITIONS,INCLUDE_DIRS,LIBRARIES} 596 # variables so that multiple passes append thi 743 # variables so that multiple passes append things correctly 597 # 744 # >> 745 if(Geant4_DEFINITIONS) >> 746 list(REMOVE_DUPLICATES Geant4_DEFINITIONS) >> 747 endif() >> 748 # - Create an interface target to export the selected definitions as >> 749 # usage requirements >> 750 if(NOT TARGET Geant4::G4UIVisDefinitions) >> 751 add_library(Geant4::G4UIVisDefinitions INTERFACE IMPORTED) >> 752 endif() >> 753 string(REGEX REPLACE "^\-D|;-D" ";" G4UIVIS_COMPILE_DEFINITIONS "${Geant4_DEFINITIONS}") >> 754 set_target_properties(Geant4::G4UIVisDefinitions PROPERTIES >> 755 INTERFACE_COMPILE_DEFINITIONS "${G4UIVIS_COMPILE_DEFINITIONS}") >> 756 unset(G4UIVIS_COMPILE_DEFINITIONS) >> 757 >> 758 list(APPEND Geant4_LIBRARIES Geant4::G4UIVisDefinitions) >> 759 598 if(Geant4_INCLUDE_DIRS) 760 if(Geant4_INCLUDE_DIRS) 599 list(REMOVE_DUPLICATES Geant4_INCLUDE_DIRS) 761 list(REMOVE_DUPLICATES Geant4_INCLUDE_DIRS) 600 endif() 762 endif() 601 763 602 if(Geant4_LIBRARIES) 764 if(Geant4_LIBRARIES) 603 list(REMOVE_DUPLICATES Geant4_LIBRARIES) 765 list(REMOVE_DUPLICATES Geant4_LIBRARIES) 604 endif() 766 endif() 605 767 606 #--------------------------------------------- 768 #----------------------------------------------------------------------- 607 # Point the user to the UseGeant4.cmake file w 769 # Point the user to the UseGeant4.cmake file which they may wish to include 608 # to help them with setting up Geant4 770 # to help them with setting up Geant4 609 # 771 # 610 set(Geant4_USE_FILE "${_geant4_thisdir}/UseGea 772 set(Geant4_USE_FILE "${_geant4_thisdir}/UseGeant4.cmake") 611 773 612 #--------------------------------------------- 774 #----------------------------------------------------------------------- 613 # Pop our custom module path from the CMake on 775 # Pop our custom module path from the CMake one 614 list(REMOVE_AT CMAKE_MODULE_PATH 0) 776 list(REMOVE_AT CMAKE_MODULE_PATH 0) 615 777 616 #--------------------------------------------- 778 #----------------------------------------------------------------------- 617 # Check FOUNDness of required components. 779 # Check FOUNDness of required components. 618 foreach(_comp ${Geant4_FIND_COMPONENTS}) 780 foreach(_comp ${Geant4_FIND_COMPONENTS}) 619 if(NOT Geant4_${_comp}_FOUND) 781 if(NOT Geant4_${_comp}_FOUND) 620 if(Geant4_FIND_REQUIRED_${_comp}) 782 if(Geant4_FIND_REQUIRED_${_comp}) 621 message(WARNING "Geant4 required compone 783 message(WARNING "Geant4 required component '${_comp}' not found") 622 set(Geant4_FOUND FALSE) 784 set(Geant4_FOUND FALSE) 623 endif() 785 endif() 624 endif() 786 endif() 625 endforeach() 787 endforeach() 626 788 627 #--------------------------------------------- 789 #----------------------------------------------------------------------- 628 # Reporting via FindPackageHandleStandardArgs 790 # Reporting via FindPackageHandleStandardArgs "CONFIG_MODE" to give a better message on being found 629 include(FindPackageHandleStandardArgs) 791 include(FindPackageHandleStandardArgs) 630 set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE 792 set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}") 631 find_package_handle_standard_args(@PROJECT_NAM 793 find_package_handle_standard_args(@PROJECT_NAME@ CONFIG_MODE)