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