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 # As this file is configured by Geant4's CMake system it SHOULD NOT BE EDITED 4 # << 5 # It defines the following variables 4 # It defines the following variables 6 # Geant4_INCLUDE_DIRS - include directories f 5 # Geant4_INCLUDE_DIRS - include directories for Geant4 >> 6 # Geant4_DEFINITIONS - compile definitions needed to use Geant4 7 # Geant4_LIBRARIES - libraries to link aga 7 # Geant4_LIBRARIES - libraries to link against 8 # Geant4_BUILD_TYPE - Build type (e.g. "Rel << 9 # install. Only set if << 10 # a single mode tool (e << 11 # Geant4_CXX_FLAGS - Recommended CXX flags 8 # Geant4_CXX_FLAGS - Recommended CXX flags for the compiler used to 12 # build the Geant4 libr 9 # build the Geant4 libraries. 13 # Geant4_CXX_FLAGS_<CONFIG> - Recommended CXX 10 # Geant4_CXX_FLAGS_<CONFIG> - Recommended CXX flags for build mode CONFIG. 14 # Geant4_USE_FILE - path to a CMake modul << 11 # Geant4_USE_FILE - path to a CMake module which may be included to help 15 # help setup CMake vari << 12 # setup CMake variables 16 # Geant4_CXXSTD - C++ Standard used to << 17 # Geant4_TLS_MODEL - Thread Local Storage << 18 # the build used an exp << 19 # 13 # 20 # You may supply a version number through find 14 # You may supply a version number through find_package which will be checked 21 # against the version of this build. Standard 15 # against the version of this build. Standard CMake logic is used so that 22 # the EXACT flag may be passed, and otherwise 16 # the EXACT flag may be passed, and otherwise this build will report itself 23 # as compatible with the requested version if: 17 # as compatible with the requested version if: 24 # 18 # 25 # VERSION_OF_THIS_BUILD >= VERSION_REQUESTED 19 # VERSION_OF_THIS_BUILD >= VERSION_REQUESTED 26 # 20 # 27 # By default only the core (or kernel) of Gean << 21 # By default only the core (or kernel) of Geant4 is activated by this module. 28 # module. You can specify additional component << 22 # You can specify additional components of Geant4 through the COMPONENTS 29 # COMPONENTS argument to find_package. By defa << 23 # argument to find_package. By default, all core libraries of Geant4 are 30 # Geant4 are appended to the Geant4_LIBRARIES << 24 # appended to the Geant4_LIBRARIES variable. Specifiying additional components 31 # additional components will enable a check on << 25 # will enable a check on the existence of these components, with the following 32 # components, with the following per component << 26 # per component variables being set: 33 # 27 # 34 # Geant4_${COMPONENT}_FOUND TRUE is the Ge 28 # Geant4_${COMPONENT}_FOUND TRUE is the Geant4 library "component" was 35 # found 29 # found 36 # 30 # 37 # Geant4_${COMPONENT}_LIBRARY Contains the l 31 # Geant4_${COMPONENT}_LIBRARY Contains the library for the specified 38 # "component" IF 32 # "component" IF the component is a library. 39 # 33 # 40 # In Geant4, components can be optional subcom << 34 # In Geant4, components can be optional subcomponents of an always available 41 # available library. In that case there will b << 35 # library. In that case there will be no Geant4_{COMPONENT}_LIBRARY variable. 42 # Geant4_{COMPONENT}_LIBRARY variable. These n << 36 # These non-library components are generally activated by compile definitions, 43 # generally activated by compile definitions t << 37 # and in these cases the appropriate definition will be added to the 44 # COMPILE_DEFINITIONS property. << 38 # Geant4_DEFINITIONS component 45 # << 39 # 46 # If you use the REQUIRED and/or COMPONENTS ar << 40 # If you specify components and use the REQUIRED option to find_package, then 47 # specify components, then the module will iss << 41 # the module will issue a FATAL_ERROR if this build of Geant does not have 48 # found Geant4 does not have the requested com << 42 # the requested component(s). 49 # specified through the OPTIONAL_COMPONENTS ar << 50 # only if the found Geant4 supports them, with << 51 # they are not supported. << 52 # << 53 # The components available generally correspon << 54 # the Geant4 libraries or optional extras that << 55 # << 56 # Library Configuration << 57 # --------------------- << 58 # static (Static libraries availab << 59 # when static libraries ar << 60 # Geant4_LIBRARIES being p << 61 # versions of the Geant4 l << 62 # guarantee the use of sta << 63 # multithreaded (Libraries are multithrea << 64 # << 65 # usolids (Geant4 solids are replac << 66 # 43 # 67 # smartstack (G4event library G4StackM << 44 # The list of components available generally corresponds to the optional extras >> 45 # that Geant4 can be built with and are: 68 # 46 # 69 # php_as_hp (G4processes library Part << 70 # << 71 # Optional Components << 72 # ------------------- << 73 # gdml (GDML support) 47 # gdml (GDML support) 74 # g3tog4 (Geant3 geometry call lis 48 # g3tog4 (Geant3 geometry call list reader library) 75 # freetype (G4analysis library has f << 76 # hdf5 (G4analysis library has H << 77 # 49 # 78 # ui_tcsh (TCsh Style Application C 50 # ui_tcsh (TCsh Style Application Command Line Interface) 79 # ui_win32 (WIN32 Style Application 51 # ui_win32 (WIN32 Style Application Command Line Interface) 80 # 52 # 81 # motif (Motif-X11/OpenGL Graphic 53 # motif (Motif-X11/OpenGL Graphical User Interface) 82 # qt (Qt/OpenGL Graphical User << 54 # qt (Qt4/OpenGL Graphical User Interface) 83 # 55 # 84 # vis_Vtk (VTK Graphical User Inter << 56 # vis_network_dawn (Client/Server network interface to DAWN visualization) 85 # vis_openinventor (OpenInventor visualizati << 57 # vis_network_vrml (Client/Server network interface to VRML visualization) 86 # vis_opengl_x11 (OpenGL visualization wit 58 # vis_opengl_x11 (OpenGL visualization with X11 interface) 87 # vis_opengl_win32 (OpenGL visualization wit 59 # vis_opengl_win32 (OpenGL visualization with X11 interface) 88 # vis_raytracer_x11 (RayTracer visualization 60 # vis_raytracer_x11 (RayTracer visualization with X11 interface) >> 61 # vis_openinventor (OpenInventor visualization) 89 # 62 # 90 # In addition, two 'shorthand' components are 63 # In addition, two 'shorthand' components are defined to help activate all 91 # available User Interface and Visualization d 64 # available User Interface and Visualization drivers: 92 # << 65 # 93 # ui_all (All available UI drivers 66 # ui_all (All available UI drivers) 94 # vis_all (All available Vis driver 67 # vis_all (All available Vis drivers) 95 # 68 # 96 # These never result in a FATAL_ERROR, even if << 69 # These never result in a FATAL_ERROR, even if the REQUIRED find_package 97 # argument is set. This is because these optio 70 # argument is set. This is because these options do not depend on specific 98 # components being available. 71 # components being available. 99 # 72 # 100 # You can also query whether the Geant4 found << 73 # =========================================================================== 101 # versions of CLHEP, ZLIB, or Expat after call << 102 # << 103 # Geant4_builtin_clhep_FOUND (TRUE if Geant << 104 # Geant4_system_clhep_FOUND (TRUE if Geant << 105 # Geant4_builtin_expat_FOUND (TRUE if Geant << 106 # Geant4_builtin_zlib_FOUND (TRUE if Geant << 107 # << 108 # These are not used via components as they do << 109 # the use of Geant4 in an application unless y << 110 # calls to these APIs. As the builtin librarie << 111 # required directly by the Geant4 toolkit, you << 112 # configure time check in these cases that the << 113 # the calls required. In both cases, the Geant << 114 # Geant4_LIBRARIES variables will be populated << 115 # system APIs as required, and you should use << 116 # and link against the same API version. << 117 # << 118 # Environment variables for, and directory pat << 119 # used by some Geant4 physics processes may be << 120 # variables << 121 # << 122 # Geant4_DATASETS (List of data << 123 # Geant4_DATASET_<NAME>_ENVVAR (Name of envi << 124 # Geant4 to ob << 125 # <NAME>) << 126 # Geant4_DATASET_<NAME>_PATH (Path to data << 127 # point to a n << 128 # was configur << 129 # << 130 #--------------------------------------------- << 131 # Variables used by this module which can chan 74 # Variables used by this module which can change the default behaviour of 132 # this module. They need to be set prior to th 75 # this module. They need to be set prior to the call to find_package 133 # 76 # 134 # Geant4_CONFIG_DEBUG If set, enable extra << 77 # Geant4_CONFIG_DEBUG If set, enable extra messaging output which can be 135 # be helpful in debugg << 78 # helpful in debugging and identifying problems with 136 # with the configurati << 79 # the configuration. 137 # 80 # 138 #--------------------------------------------- << 81 #---------------------------------------------------------------------------- 139 82 140 #--------------------------------------------- << 83 #---------------------------------------------------------------------------- 141 # DEBUG : print out the variables passed via f 84 # DEBUG : print out the variables passed via find_package arguments 142 # 85 # 143 if(Geant4_CONFIG_DEBUG) 86 if(Geant4_CONFIG_DEBUG) 144 message(STATUS "G4CFG_DEBUG : Geant4_VERSION 87 message(STATUS "G4CFG_DEBUG : Geant4_VERSION = ${Geant4_VERSION}") 145 message(STATUS "G4CFG_DEBUG : Geant4_FIND_VE 88 message(STATUS "G4CFG_DEBUG : Geant4_FIND_VERSION = ${Geant4_FIND_VERSION}") 146 message(STATUS "G4CFG_DEBUG : Geant4_FIND_RE 89 message(STATUS "G4CFG_DEBUG : Geant4_FIND_REQUIRED = ${Geant4_FIND_REQUIRED}") 147 message(STATUS "G4CFG_DEBUG : Geant4_FIND_CO 90 message(STATUS "G4CFG_DEBUG : Geant4_FIND_COMPONENTS = ${Geant4_FIND_COMPONENTS}") 148 91 149 foreach(_cpt ${Geant4_FIND_COMPONENTS}) 92 foreach(_cpt ${Geant4_FIND_COMPONENTS}) 150 message(STATUS "G4CFG_DEBUG : Geant4_FIND_ 93 message(STATUS "G4CFG_DEBUG : Geant4_FIND_REQUIRED_${_cpt} = ${Geant4_FIND_REQUIRED_${_cpt}}") 151 endforeach() 94 endforeach() 152 95 153 message(STATUS "G4CFG_DEBUG : Geant4_LIBDEPS 96 message(STATUS "G4CFG_DEBUG : Geant4_LIBDEPS_LOADED = ${Geant4_LIBDEPS_LOADED}") 154 endif() 97 endif() 155 98 156 #--------------------------------------------- 99 #----------------------------------------------------------------------- 157 # Check that consumers use the minimum needed << 100 # Locate ourselves, since all other config files should have been 158 # Geant4 uses cxx_std_EP to define the standar << 159 # 3.8 and above support EP=17. 3.12 and above << 160 # We continue to support the earlier version w << 161 cmake_policy(VERSION 3.8...3.18) << 162 if(CMAKE_VERSION VERSION_LESS 3.8) << 163 message(FATAL_ERROR "Projects consuming Gean << 164 endif() << 165 << 166 if(("@CMAKE_CXX_STANDARD@" GREATER_EQUAL 23) A << 167 message(FATAL_ERROR "Projects consuming Gean << 168 endif() << 169 << 170 if(("@CMAKE_CXX_STANDARD@" GREATER_EQUAL 20) A << 171 message(FATAL_ERROR "Projects consuming Gean << 172 endif() << 173 << 174 # - Help find dependencies << 175 include(CMakeFindDependencyMacro) << 176 << 177 #--------------------------------------------- << 178 # Locate ourselves, since all other config fil << 179 # installed alongside us... 101 # installed alongside us... 180 # 102 # 181 get_filename_component(_geant4_thisdir "${CMAK << 103 get_filename_component(_thisdir "${CMAKE_CURRENT_LIST_FILE}" PATH) 182 104 183 #--------------------------------------------- 105 #----------------------------------------------------------------------- 184 # Provide *recommended* compiler flags used by 106 # Provide *recommended* compiler flags used by this build of Geant4 185 # Don't mess with the actual CMAKE_CXX_FLAGS!! 107 # Don't mess with the actual CMAKE_CXX_FLAGS!!! 186 # It's up to the user what to do with these 108 # It's up to the user what to do with these 187 @GEANT4_COMPILER_FLAG_HINTS@ 109 @GEANT4_COMPILER_FLAG_HINTS@ 188 110 189 # - Provide variable indicating C++ Standard w << 111 #----------------------------------------------------------------------- 190 set(Geant4_CXX_STANDARD "@CMAKE_CXX_STANDARD@" << 112 # Set the base compile definitions required to use Geant4 if the variable >> 113 # does not exist (we do this to ensure multiple calls to find_package >> 114 # don't overwrite previous invocations) >> 115 # Components may append to this >> 116 # We set VIS/UI_USE directly here, because for now they are, unfortunately, >> 117 # always needed for the Examples. >> 118 # However, they ARE NOT required to use Geant4 itself. >> 119 # >> 120 if(NOT Geant4_DEFINITIONS) >> 121 set(Geant4_DEFINITIONS @GEANT4_CORE_DEFINITIONS@) >> 122 endif() >> 123 >> 124 # We set VIS/UI_USE directly here, because for now they are, unfortunately, >> 125 # always needed for the Examples. >> 126 # However, they ARE NOT required to use Geant4 itself. >> 127 # >> 128 if(NOT G4UI_NONE) >> 129 list(APPEND Geant4_DEFINITIONS -DG4UI_USE) >> 130 endif() >> 131 >> 132 if(NOT G4VIS_NONE) >> 133 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE) >> 134 endif() 191 135 192 #--------------------------------------------- 136 #----------------------------------------------------------------------- 193 # Configure the path to the Geant4 headers, us << 137 # Configure the path to the Geant4 headers, using a relative path if 194 # possible. This is only known at CMake time, << 138 # possible. This is only known at CMake time, so we expand a CMake 195 # supplied variable. 139 # supplied variable. 196 # 140 # 197 @GEANT4_INCLUDE_DIR_SETUP@ 141 @GEANT4_INCLUDE_DIR_SETUP@ 198 set(Geant4_INCLUDE_DIRS "${Geant4_INCLUDE_DIR} << 199 142 200 # Push our own module path onto the CMake one << 143 @GEANT4_MODULE_PATH_SETUP@ 201 # - Popped at end of this module << 202 list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRE << 203 << 204 #--------------------------------------------- << 205 # Data Resources << 206 # NB: Because data paths can be "forward decla << 207 # guarantee of data existence. They only provi << 208 # << 209 set(Geant4_DATASET_DESCRIPTIONS "@GEANT4_DATAS << 210 << 211 foreach(_g4dataset_tuple ${Geant4_DATASET_DESC << 212 # Format is NAME|ENVVAR|PATH << 213 string(REPLACE "|" ";" _g4dataset_tuple "${_ << 214 list(GET _g4dataset_tuple 0 _g4dataset_name) << 215 list(APPEND Geant4_DATASETS ${_g4dataset_nam << 216 list(GET _g4dataset_tuple 1 Geant4_DATASET_$ << 217 list(GET _g4dataset_tuple 2 Geant4_DATASET_$ << 218 endforeach() << 219 unset(Geant4_DATASET_DESCRIPTIONS) << 220 144 221 #--------------------------------------------- 145 #----------------------------------------------------------------------- 222 # Optional Build Components << 146 # Configure the path(s) to third party headers. 223 #--------------------------------------------- << 147 # This is not a perfect solution to recording dependencies on external 224 # - General Multithreading << 148 # libraries, but it does ensure that users of THIS Geant4 will pick up 225 set(Geant4_multithreaded_FOUND @GEANT4_BUILD_M << 149 # those it was built against. 226 if(Geant4_multithreaded_FOUND) << 150 # Library dependencies are generally handled through the 227 # - Define variable to indicate TLS model us << 151 # Geant4LibraryDepends file listed below (apart from one exception!) 228 set(Geant4_TLS_MODEL "@GEANT4_BUILD_TLS_MODE << 152 # 229 if(Geant4_TLS_MODEL STREQUAL "auto") << 153 set(Geant4_THIRD_PARTY_INCLUDE_DIRS @GEANT4_THIRD_PARTY_INCLUDES@) 230 unset(Geant4_TLS_MODEL) << 231 endif() << 232 endif() << 233 154 234 # - Smart track stack << 155 #----------------------------------------------------------------------- 235 set(Geant4_smartstack_FOUND @GEANT4_USE_SMARTS << 156 # Construct overall include path for using Geant4 >> 157 # >> 158 set(Geant4_INCLUDE_DIRS >> 159 ${Geant4_INCLUDE_DIR} >> 160 ${Geant4_THIRD_PARTY_INCLUDE_DIRS}) 236 161 237 # - ParticleHP as HP << 162 #----------------------------------------------------------------------- 238 set(Geant4_php_as_hp_FOUND @GEANT4_BUILD_PHP_A << 163 # If we have used imported targets for any third party packages, reimport >> 164 # them here, BEFORE we try and import the Geant4 targets which are >> 165 # linked against them. >> 166 # Generally, we try and use a standard find_package, but try and force it >> 167 # to find the actual package we were built against. >> 168 # THIS IS NOT PERFECT, AS IT CANNOT GUARANTEE A BINARY COMPATIBLE >> 169 # PACKAGE IS FOUND. >> 170 @GEANT4_THIRD_PARTY_IMPORT_SETUP@ 239 171 240 # - G3toG4 << 172 #----------------------------------------------------------------------- 241 set(Geant4_g3tog4_FOUND @GEANT4_USE_G3TOG4@) << 173 # Include the file listing all the imported targets. 242 if(Geant4_g3tog4_FOUND) << 174 # (Not needed if used in the same Geant4 project, or if we have run before) 243 if(Geant4_FIND_REQUIRED_g3tog4) << 175 # This is always installed in the same location as us... 244 set(_geant4_use_g3tog4_library ON) << 176 # >> 177 if(NOT CMAKE_PROJECT_NAME STREQUAL Geant4) >> 178 if(NOT Geant4_LIBDEPS_LOADED) >> 179 include("${_thisdir}/Geant4LibraryDepends.cmake") >> 180 set(Geant4_LIBDEPS_LOADED 1) 245 endif() 181 endif() 246 endif() 182 endif() 247 183 248 #--------------------------------------------- 184 #----------------------------------------------------------------------- 249 # Optional Components that may depend on exter << 185 # Setup components. >> 186 # THIS SECTION IS VERY ROUGH AND VERY MUCH CUT AND PASTE. >> 187 # TODO: INVESTIGATE TIDY UP WITH LESS PROCESSING. 250 #--------------------------------------------- 188 #----------------------------------------------------------------------- 251 # Optionally import build-time package setting << 189 # Many components are simply present as parts of libraries or always built 252 # for find_package to work with << 190 # but require additional compile definitions. 253 include("${CMAKE_CURRENT_LIST_DIR}/Geant4Packa << 191 # 254 << 255 # - CLHEP << 256 set(Geant4_system_clhep_FOUND @GEANT4_USE_SYST << 257 if(Geant4_system_clhep_FOUND) << 258 set(Geant4_builtin_clhep_FOUND FALSE) << 259 find_dependency(CLHEP @CLHEP_VERSION@ EXACT << 260 else() << 261 set(Geant4_builtin_clhep_FOUND TRUE) << 262 endif() << 263 << 264 # - EXPAT << 265 set(Geant4_builtin_expat_FOUND @GEANT4_USE_BUI << 266 if(NOT Geant4_builtin_expat_FOUND) << 267 find_dependency(EXPAT @EXPAT_VERSION_STRING@ << 268 include("${CMAKE_CURRENT_LIST_DIR}/G4EXPATSh << 269 endif() << 270 << 271 # - ZLIB << 272 set(Geant4_builtin_zlib_FOUND @GEANT4_USE_BUIL << 273 if(NOT Geant4_builtin_zlib_FOUND) << 274 find_dependency(ZLIB @ZLIB_VERSION_STRING@) << 275 endif() << 276 << 277 # - PTL/TBB << 278 set(Geant4_system_ptl_FOUND @GEANT4_USE_SYSTEM << 279 set(Geant4_TBB_FOUND @GEANT4_USE_TBB@) << 280 if(Geant4_system_ptl_FOUND) << 281 set(Geant4_builtin_ptl_FOUND FALSE) << 282 if(Geant4_TBB_FOUND) << 283 find_dependency(PTL @PTL_VERSION@ COMPONEN << 284 else() << 285 find_dependency(PTL @PTL_VERSION@) << 286 endif() << 287 else() << 288 # We know exactly where PTL is << 289 set(Geant4_builtin_ptl_FOUND TRUE) << 290 if(CMAKE_VERSION VERSION_GREATER 3.8.9999) << 291 find_dependency(PTL NO_DEFAULT_PATH PATHS << 292 else() << 293 find_package(PTL REQUIRED NO_DEFAULT_PATH << 294 endif() << 295 endif() << 296 << 297 # - GDML 192 # - GDML 298 set(Geant4_gdml_FOUND @GEANT4_USE_GDML@) 193 set(Geant4_gdml_FOUND @GEANT4_USE_GDML@) 299 if(Geant4_gdml_FOUND) 194 if(Geant4_gdml_FOUND) 300 find_dependency(XercesC @XercesC_VERSION@) << 195 list(REMOVE_ITEM Geant4_FIND_COMPONENTS gdml) 301 endif() 196 endif() 302 197 303 # - VecGeom << 198 # - G3toG4 304 set(Geant4_usolids_FOUND @GEANT4_USE_USOLIDS_E << 199 set(Geant4_g3tog4_FOUND @GEANT4_USE_G3TOG4@) 305 if(Geant4_usolids_FOUND) << 200 if(Geant4_g3tog4_FOUND) 306 find_dependency(VecGeom @VecGeom_VERSION@) << 201 if(Geant4_FIND_REQUIRED_g3tog4) >> 202 set(_geant4_use_g3tog4_library ON) >> 203 endif() >> 204 list(REMOVE_ITEM Geant4_FIND_COMPONENTS g3tog4) 307 endif() 205 endif() 308 206 309 # - Freetype << 207 # - UI : TCSH 310 set(Geant4_freetype_FOUND @GEANT4_USE_FREETYPE << 208 set(Geant4_ui_tcsh_FOUND @UNIX@) 311 if(Geant4_freetype_FOUND) << 209 if(Geant4_ui_tcsh_FOUND) 312 find_dependency(Freetype @FREETYPE_VERSION_S << 210 if(Geant4_FIND_REQUIRED_ui_tcsh OR Geant4_FIND_REQUIRED_ui_all) 313 include("${CMAKE_CURRENT_LIST_DIR}/G4Freetyp << 211 list(APPEND Geant4_DEFINITIONS -DG4UI_USE_TCSH) >> 212 endif() >> 213 list(REMOVE_ITEM Geant4_FIND_COMPONENTS ui_tcsh) 314 endif() 214 endif() 315 215 316 # - HDF5 << 216 # - UI : win32 317 set(Geant4_hdf5_FOUND @GEANT4_USE_HDF5@) << 217 set(Geant4_ui_win32_FOUND @WIN32@) 318 if(Geant4_hdf5_FOUND) << 218 if(Geant4_ui_win32_FOUND) 319 find_dependency(HDF5) << 219 if(Geant4_FIND_REQUIRED_ui_win32 OR Geant4_FIND_REQUIRED_ui_all) 320 include("${CMAKE_CURRENT_LIST_DIR}/G4HDF5Shi << 220 list(APPEND >> 221 Geant4_DEFINITIONS >> 222 -DG4INTY_USE_WIN32 >> 223 -DG4UI_USE_WIN32 >> 224 ) >> 225 endif() >> 226 list(REMOVE_ITEM Geant4_FIND_COMPONENTS ui_win32) 321 endif() 227 endif() 322 228 323 #--------------------------------------------- << 229 # - Visualization : Network DAWN 324 # UI/VIS << 230 set(Geant4_vis_dawn_network_FOUND @GEANT4_USE_NETWORK_DAWN@) 325 # << 231 if(Geant4_vis_dawn_network_FOUND) 326 # Prefer Legacy GL when using CMake >= 3.10 << 232 if(Geant4_FIND_REQUIRED_vis_dawn_network OR Geant4_FIND_REQUIRED_vis_all) 327 set(OpenGL_GL_PREFERENCE_SAVE "${OpenGL_GL_PRE << 233 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_DAWN) 328 set(OpenGL_GL_PREFERENCE "LEGACY") << 234 endif() 329 << 235 list(REMOVE_ITEM Geant4_FIND_COMPONENTS vis_dawn_network) 330 # - Helper variables for ui/vis_all components << 331 if("ui_all" IN_LIST Geant4_FIND_COMPONENTS) << 332 set(Geant4_ui_all_FOUND TRUE) << 333 endif() 236 endif() 334 237 335 if("vis_all" IN_LIST Geant4_FIND_COMPONENTS) << 238 # - Visualization : Network VRML 336 set(Geant4_vis_all_FOUND TRUE) << 239 set(Geant4_vis_vrml_network_FOUND @GEANT4_USE_NETWORK_VRML@) >> 240 if(Geant4_vis_vrml_network_FOUND) >> 241 if(Geant4_FIND_REQUIRED_vis_vrml_network OR Geant4_FIND_REQUIRED_vis_all) >> 242 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_VRML) >> 243 endif() >> 244 list(REMOVE_ITEM Geant4_FIND_COMPONENTS vis_vrml_network) 337 endif() 245 endif() 338 246 339 # - UI : TCSH << 247 #---------------------------------------------------------------------------- 340 set(Geant4_ui_tcsh_FOUND @UNIX@) << 341 << 342 # - UI : win32 << 343 set(Geant4_ui_win32_FOUND @WIN32@) << 344 << 345 #--------------------------------------------- << 346 # Components which requires slightly more comp 248 # Components which requires slightly more complex setup 347 # 249 # 348 # - Visualization : RayTracerX 250 # - Visualization : RayTracerX 349 set(Geant4_vis_raytracer_x11_FOUND @GEANT4_USE 251 set(Geant4_vis_raytracer_x11_FOUND @GEANT4_USE_RAYTRACER_X11@) 350 if(Geant4_vis_raytracer_x11_FOUND) 252 if(Geant4_vis_raytracer_x11_FOUND) 351 find_dependency(X11) << 253 if(Geant4_FIND_REQUIRED_vis_raytracer_x11 OR Geant4_FIND_REQUIRED_vis_all) 352 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim << 254 list(APPEND >> 255 Geant4_DEFINITIONS >> 256 -DG4INTY_USE_XT >> 257 -DG4VIS_USE_RAYTRACERX >> 258 ) >> 259 endif() >> 260 list(REMOVE_ITEM Geant4_FIND_COMPONENTS vis_raytracer_x11) 353 endif() 261 endif() 354 262 355 # - Qt (UI and Vis!) 263 # - Qt (UI and Vis!) 356 set(Geant4_qt_FOUND @GEANT4_USE_QT@) 264 set(Geant4_qt_FOUND @GEANT4_USE_QT@) 357 set(Geant4_qt3d_FOUND @GEANT4_USE_QT3D@) << 358 if(Geant4_qt_FOUND) 265 if(Geant4_qt_FOUND) 359 # Must always refind Qt to recreate imported << 266 if(Geant4_FIND_REQUIRED_qt OR Geant4_FIND_REQUIRED_ui_all OR 360 # are in the public interface, always need l << 267 Geant4_FIND_REQUIRED_vis_all) 361 find_dependency(Qt@QT_VERSION_MAJOR@Core REQ << 268 list(APPEND 362 find_dependency(Qt@QT_VERSION_MAJOR@Gui REQU << 269 Geant4_DEFINITIONS 363 find_dependency(Qt@QT_VERSION_MAJOR@Widgets << 270 -DG4INTY_USE_QT 364 find_dependency(Qt@QT_VERSION_MAJOR@OpenGL R << 271 -DG4UI_USE_QT 365 if(@QT_VERSION_MAJOR@ GREATER 5) << 272 -DG4VIS_USE_OPENGLQT 366 find_dependency(Qt@QT_VERSION_MAJOR@OpenGL << 273 ) 367 endif() << 368 << 369 if(Geant4_qt3d_FOUND) << 370 find_dependency(Qt@QT_VERSION_MAJOR@3DCore << 371 find_dependency(Qt@QT_VERSION_MAJOR@3DExtr << 372 find_dependency(Qt@QT_VERSION_MAJOR@3DRend << 373 endif() << 374 << 375 # Also require OpenGL << 376 find_dependency(OpenGL) << 377 << 378 # Qt must be activated both directly and for << 379 if(("qt" IN_LIST Geant4_FIND_COMPONENTS) << 380 OR ("vis_openinventor" IN_LIST Geant4_FIN << 381 OR Geant4_ui_all_FOUND OR Geant4_vis_all_ << 382 set(_geant4_use_opengl_library ON) 274 set(_geant4_use_opengl_library ON) 383 # Qt3D is always on if available << 384 set(_geant4_use_qt3D_library ${Geant4_qt3d << 385 endif() 275 endif() >> 276 list(REMOVE_ITEM Geant4_FIND_COMPONENTS qt) 386 endif() 277 endif() 387 278 388 # - Motif (UI and Vis!) 279 # - Motif (UI and Vis!) 389 set(Geant4_motif_FOUND @GEANT4_USE_XM@) 280 set(Geant4_motif_FOUND @GEANT4_USE_XM@) 390 if(Geant4_motif_FOUND) 281 if(Geant4_motif_FOUND) 391 find_dependency(X11) << 282 if(Geant4_FIND_REQUIRED_motif OR Geant4_FIND_REQUIRED_ui_all OR 392 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim << 283 Geant4_FIND_REQUIRED_vis_all) 393 find_dependency(Motif) << 284 list(APPEND 394 include("${CMAKE_CURRENT_LIST_DIR}/G4MotifSh << 285 Geant4_DEFINITIONS 395 if(APPLE) << 286 -DG4INTY_USE_XT 396 find_dependency(XQuartzGL) << 287 -DG4UI_USE_XM 397 else() << 288 -DG4VIS_USE_OPENGLXM 398 find_dependency(OpenGL) << 289 ) 399 endif() << 400 << 401 # Motif can be activated both directly and f << 402 if(("motif" IN_LIST Geant4_FIND_COMPONENTS) << 403 OR ("vis_openinventor" IN_LIST Geant4_FIN << 404 OR Geant4_ui_all_FOUND OR Geant4_vis_all_ << 405 set(_geant4_use_opengl_library ON) 290 set(_geant4_use_opengl_library ON) 406 endif() 291 endif() >> 292 >> 293 list(REMOVE_ITEM Geant4_FIND_COMPONENTS motif) 407 endif() 294 endif() 408 295 409 # - OpenGL X11 296 # - OpenGL X11 410 set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OP 297 set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OPENGL_X11@) 411 if(Geant4_vis_opengl_x11_FOUND) 298 if(Geant4_vis_opengl_x11_FOUND) 412 find_dependency(X11) << 299 if(Geant4_FIND_REQUIRED_vis_opengl_x11 OR Geant4_FIND_REQUIRED_vis_all) 413 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim << 300 list(APPEND 414 if(APPLE) << 301 Geant4_DEFINITIONS 415 find_dependency(XQuartzGL) << 302 -DG4INTY_USE_XT 416 else() << 303 -DG4VIS_USE_OPENGLX 417 find_dependency(OpenGL) << 304 ) >> 305 set(_geant4_use_opengl_library ON) 418 endif() 306 endif() 419 307 420 if(("vis_opengl_x11" IN_LIST Geant4_FIND_COM << 308 list(REMOVE_ITEM Geant4_FIND_COMPONENTS vis_opengl_x11) 421 set(_geant4_use_opengl_library ON) << 422 endif() << 423 endif() 309 endif() 424 310 425 # - OpenGL Win32 311 # - OpenGL Win32 426 set(Geant4_vis_opengl_win32_FOUND @GEANT4_USE_ 312 set(Geant4_vis_opengl_win32_FOUND @GEANT4_USE_OPENGL_WIN32@) 427 if(Geant4_vis_opengl_win32_FOUND) 313 if(Geant4_vis_opengl_win32_FOUND) 428 find_dependency(OpenGL) << 314 if(Geant4_FIND_REQUIRED_vis_opengl_win32 OR Geant4_FIND_REQUIRED_vis_all) 429 if(("vis_opengl_win32" IN_LIST Geant4_FIND_C << 315 list(APPEND 430 set(_geant4_use_opengl_library ON) << 316 Geant4_DEFINITIONS >> 317 -DG4INTY_USE_WIN32 >> 318 -DG4VIS_USE_OPENGLWIN32 >> 319 ) >> 320 set(_geant4_use_opengl_library ON) 431 endif() 321 endif() >> 322 >> 323 list(REMOVE_ITEM Geant4_FIND_COMPONENTS vis_opengl_win32) 432 endif() 324 endif() 433 325 434 # - OpenInventor 326 # - OpenInventor 435 set(Geant4_vis_openinventor_FOUND @GEANT4_USE_ 327 set(Geant4_vis_openinventor_FOUND @GEANT4_USE_INVENTOR@) 436 set(Geant4_vis_openinventor_qt_FOUND @GEANT4_U << 437 if(Geant4_vis_openinventor_FOUND) 328 if(Geant4_vis_openinventor_FOUND) 438 find_dependency(Coin) << 329 if(Geant4_FIND_REQUIRED_vis_openinventor OR Geant4_FIND_REQUIRED_vis_all) 439 << 330 if(UNIX AND NOT WIN32) 440 if(Geant4_vis_openinventor_qt_FOUND) << 331 list(APPEND Geant4_DEFINITIONS 441 # Qt dependency handled by Geant4_vis_qt_F << 332 -DG4INTY_USE_XT 442 # always ON if Inventor_QT is << 333 -DG4VIS_USE_OI 443 find_dependency(SoQt) << 334 -DG4VIS_USE_OIX 444 else() << 335 ) 445 if(WIN32) << 336 elseif(WIN32) 446 find_dependency(SoWin) << 337 list(APPEND Geant4_DEFINITIONS 447 else() << 338 -G4INTY_USE_WIN32 448 # Motif/X11/GL dependency handled by Gea << 339 -DG4VIS_USE_OI 449 # always ON if Inventor/Xt is. << 340 -DG4VIS_USE_OIWIN32 450 find_dependency(SoXt) << 341 ) 451 endif() 342 endif() 452 endif() << 453 343 454 if(("vis_openinventor" IN_LIST Geant4_FIND_C << 455 set(_geant4_use_inventor_library ON) 344 set(_geant4_use_inventor_library ON) 456 endif() 345 endif() 457 endif() << 458 << 459 # Reset any OpenGL Preference << 460 set(OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFEREN << 461 346 462 set(Geant4_vis_Vtk_FOUND @GEANT4_USE_VTK@) << 347 list(REMOVE_ITEM Geant4_FIND_COMPONENTS vis_openinventor) 463 if(Geant4_vis_Vtk_FOUND) << 464 find_dependency(VTK 9 REQUIRED COMPONENTS << 465 CommonColor << 466 InteractionStyle << 467 IOExport << 468 GUISupportQt << 469 RenderingVolumeOpenGL2 << 470 ) << 471 set(_geant4_use_vtk_library ON) << 472 endif() 348 endif() 473 349 474 #--------------------------------------------- << 475 # Include the files listing all the imported t << 476 # Intel/MSVC Compile Features << 477 # (Not needed if used in the same Geant4 proje << 478 # This is always installed in the same locatio << 479 # << 480 if(NOT CMAKE_PROJECT_NAME STREQUAL Geant4) << 481 include("${_geant4_thisdir}/Modules/IntelCom << 482 include("${_geant4_thisdir}/Modules/MSVCComp << 483 << 484 if(NOT Geant4_LIBDEPS_LOADED) << 485 include("${_geant4_thisdir}/Geant4LibraryD << 486 set(Geant4_LIBDEPS_LOADED 1) << 487 endif() << 488 endif() << 489 350 490 #--------------------------------------------- 351 #----------------------------------------------------------------------- 491 # Now perform final configuration of libraries 352 # Now perform final configuration of libraries... 492 # We provide FOUND variables for presence of s << 353 # We provide FOUND variables for shared and static but for now we don't 493 # User can supply "static" component to force << 354 # allow users to choose - we prefer shared if available, and fallback to 494 # available. << 355 # static otherwise >> 356 # 495 set(Geant4_shared_FOUND @BUILD_SHARED_LIBS@) 357 set(Geant4_shared_FOUND @BUILD_SHARED_LIBS@) 496 set(Geant4_static_FOUND @BUILD_STATIC_LIBS@) 358 set(Geant4_static_FOUND @BUILD_STATIC_LIBS@) 497 359 498 # - Default setting : shared if available, sta << 499 if(Geant4_shared_FOUND) 360 if(Geant4_shared_FOUND) 500 set(_geant4_lib_use_suffix "") 361 set(_geant4_lib_use_suffix "") 501 else() 362 else() 502 set(_geant4_lib_use_suffix "-static") 363 set(_geant4_lib_use_suffix "-static") 503 endif() 364 endif() 504 365 505 if(("static" IN_LIST Geant4_FIND_COMPONENTS) A << 506 set(_geant4_lib_use_suffix "-static") << 507 endif() << 508 << 509 # The list of libraries probably should be aut 366 # The list of libraries probably should be autogenerated, but we hard code 510 # for now. We don't have to divide the list of 367 # 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 368 # do so for consistency with the way we'll need to do it for static. 512 # - Always on Vis Components 369 # - Always on Vis Components 513 set(_geant4_internal_libraries 370 set(_geant4_internal_libraries 514 Geant4::G4Tree${_geant4_lib_use_suffix} << 371 G4Tree${_geant4_lib_use_suffix} 515 Geant4::G4FR${_geant4_lib_use_suffix} << 372 G4FR${_geant4_lib_use_suffix} 516 Geant4::G4GMocren${_geant4_lib_use_suffix} << 373 G4GMocren${_geant4_lib_use_suffix} 517 Geant4::G4visHepRep${_geant4_lib_use_suffix} << 374 G4visHepRep${_geant4_lib_use_suffix} 518 Geant4::G4RayTracer${_geant4_lib_use_suffix} << 375 G4RayTracer${_geant4_lib_use_suffix} 519 Geant4::G4VRML${_geant4_lib_use_suffix} << 376 G4VRML${_geant4_lib_use_suffix} 520 Geant4::G4ToolsSG${_geant4_lib_use_suffix}) << 377 ) 521 378 522 # - G4OpenGL if it's requested. 379 # - G4OpenGL if it's requested. 523 if(_geant4_use_opengl_library) 380 if(_geant4_use_opengl_library) 524 list(APPEND _geant4_internal_libraries Geant << 381 list(APPEND _geant4_internal_libraries 525 endif() << 382 G4OpenGL${_geant4_lib_use_suffix} 526 << 383 G4gl2ps${_geant4_lib_use_suffix} 527 # - Qt3D if it's requested. << 384 ) 528 if(_geant4_use_qt3D_library) << 385 list(APPEND Geant4_DEFINITIONS -DG4VIS_USE_OPENGL) 529 list(APPEND _geant4_internal_libraries Geant << 530 endif() 386 endif() 531 387 532 # - G4OpenInventor if it's requested. 388 # - G4OpenInventor if it's requested. 533 if(_geant4_use_inventor_library) 389 if(_geant4_use_inventor_library) 534 list(APPEND _geant4_internal_libraries Geant << 390 list(APPEND _geant4_internal_libraries 535 endif() << 391 G4OpenInventor${_geant4_lib_use_suffix} 536 << 392 ) 537 if(_geant4_use_vtk_library) << 538 list(APPEND _geant4_internal_libraries Geant << 539 endif() << 540 << 541 # - GDML always added for now as old G4persist << 542 if(Geant4_gdml_FOUND) << 543 set(_geant4_g4gdml_library Geant4::G4gdml${_ << 544 endif() 393 endif() 545 394 546 # - G3toG4 if it's requested 395 # - G3toG4 if it's requested 547 if(_geant4_use_g3tog4_library) 396 if(_geant4_use_g3tog4_library) 548 set(_geant4_g3tog4_library Geant4::G3toG4${_ << 397 set(_geant4_g3tog4_library G3toG4${_geant4_lib_use_suffix}) 549 endif() 398 endif() 550 399 551 set(_geant4_physicslists_library Geant4::G4phy << 552 << 553 # - 'Kernel' libraries 400 # - 'Kernel' libraries 554 list(APPEND _geant4_internal_libraries 401 list(APPEND _geant4_internal_libraries 555 Geant4::G4vis_management${_geant4_lib_use_su << 402 G4vis_management${_geant4_lib_use_suffix} 556 Geant4::G4modeling${_geant4_lib_use_suffix} << 403 G4modeling${_geant4_lib_use_suffix} 557 Geant4::G4interfaces${_geant4_lib_use_suffix << 404 G4interfaces${_geant4_lib_use_suffix} 558 Geant4::G4mctruth${_geant4_lib_use_suffix} << 405 G4persistency${_geant4_lib_use_suffix} 559 Geant4::G4geomtext${_geant4_lib_use_suffix} << 560 ${_geant4_g4gdml_library} << 561 ${_geant4_g3tog4_library} 406 ${_geant4_g3tog4_library} 562 Geant4::G4analysis${_geant4_lib_use_suffix} << 407 G4analysis${_geant4_lib_use_suffix} 563 Geant4::G4error_propagation${_geant4_lib_use << 408 G4error_propagation${_geant4_lib_use_suffix} 564 Geant4::G4readout${_geant4_lib_use_suffix} << 409 G4readout${_geant4_lib_use_suffix} 565 ${_geant4_physicslists_library} << 410 G4physicslists${_geant4_lib_use_suffix} 566 Geant4::G4run${_geant4_lib_use_suffix} << 411 G4run${_geant4_lib_use_suffix} 567 Geant4::G4event${_geant4_lib_use_suffix} << 412 G4event${_geant4_lib_use_suffix} 568 Geant4::G4tracking${_geant4_lib_use_suffix} << 413 G4tracking${_geant4_lib_use_suffix} 569 Geant4::G4parmodels${_geant4_lib_use_suffix} << 414 G4parmodels${_geant4_lib_use_suffix} 570 Geant4::G4processes${_geant4_lib_use_suffix} << 415 G4processes${_geant4_lib_use_suffix} 571 Geant4::G4digits_hits${_geant4_lib_use_suffi << 416 G4digits_hits${_geant4_lib_use_suffix} 572 Geant4::G4track${_geant4_lib_use_suffix} << 417 G4track${_geant4_lib_use_suffix} 573 Geant4::G4particles${_geant4_lib_use_suffix} << 418 G4particles${_geant4_lib_use_suffix} 574 Geant4::G4geometry${_geant4_lib_use_suffix} << 419 G4geometry${_geant4_lib_use_suffix} 575 Geant4::G4materials${_geant4_lib_use_suffix} << 420 G4materials${_geant4_lib_use_suffix} 576 Geant4::G4graphics_reps${_geant4_lib_use_suf << 421 G4graphics_reps${_geant4_lib_use_suffix} 577 Geant4::G4intercoms${_geant4_lib_use_suffix} << 422 G4intercoms${_geant4_lib_use_suffix} 578 Geant4::G4global${_geant4_lib_use_suffix} << 423 G4global${_geant4_lib_use_suffix} 579 # G4tools is INTERFACE, so same for both sta << 580 Geant4::G4tools << 581 ) 424 ) 582 425 583 # - Any externals built by Geant4 426 # - Any externals built by Geant4 584 foreach(_extlib @GEANT4_EXTERNALS_TARGETS@) 427 foreach(_extlib @GEANT4_EXTERNALS_TARGETS@) 585 list(APPEND << 428 list(APPEND 586 _geant4_internal_libraries 429 _geant4_internal_libraries 587 Geant4::${_extlib}${_geant4_lib_use_suffix << 430 ${_extlib}${_geant4_lib_use_suffix} 588 ) 431 ) 589 endforeach() 432 endforeach() 590 433 591 # - Now set them to Geant4_LIBRARIES 434 # - Now set them to Geant4_LIBRARIES 592 set(Geant4_LIBRARIES ${_geant4_internal_librar 435 set(Geant4_LIBRARIES ${_geant4_internal_libraries}) 593 436 >> 437 594 #--------------------------------------------- 438 #----------------------------------------------------------------------- 595 # Remove any duplicates from the Geant4_{INCLU << 439 # Remove any duplicates from the Geant4_{DEFINITIONS,INCLUDE_DIRS,LIBRARIES} 596 # variables so that multiple passes append thi << 440 # variables so that multiple passes append things correctly 597 # 441 # 598 if(Geant4_INCLUDE_DIRS) << 442 list(REMOVE_DUPLICATES Geant4_DEFINITIONS) 599 list(REMOVE_DUPLICATES Geant4_INCLUDE_DIRS) << 443 list(REMOVE_DUPLICATES Geant4_INCLUDE_DIRS) 600 endif() << 444 list(REMOVE_DUPLICATES Geant4_LIBRARIES) 601 << 602 if(Geant4_LIBRARIES) << 603 list(REMOVE_DUPLICATES Geant4_LIBRARIES) << 604 endif() << 605 445 606 #--------------------------------------------- 446 #----------------------------------------------------------------------- 607 # Point the user to the UseGeant4.cmake file w 447 # Point the user to the UseGeant4.cmake file which they may wish to include 608 # to help them with setting up Geant4 448 # to help them with setting up Geant4 609 # 449 # 610 set(Geant4_USE_FILE "${_geant4_thisdir}/UseGea << 450 set(Geant4_USE_FILE ${_thisdir}/UseGeant4.cmake) 611 451 612 #--------------------------------------------- 452 #----------------------------------------------------------------------- 613 # Pop our custom module path from the CMake on << 453 # Finally, handle any remaining components. 614 list(REMOVE_AT CMAKE_MODULE_PATH 0) << 454 # We should have dealt with all available components above, except for >> 455 # ui_all and vis_all, and removed them from the list of FIND_COMPONENTS >> 456 # so any left we either didn't find or don't know about. Emit a warning >> 457 # if REQUIRED isn't set, or FATAL_ERROR otherwise >> 458 # >> 459 list(REMOVE_DUPLICATES Geant4_FIND_COMPONENTS) >> 460 list(REMOVE_ITEM Geant4_FIND_COMPONENTS ui_all vis_all) 615 461 616 #--------------------------------------------- << 462 foreach(_remaining ${Geant4_FIND_COMPONENTS}) 617 # Check FOUNDness of required components. << 463 if(Geant4_FIND_REQUIRED) 618 foreach(_comp ${Geant4_FIND_COMPONENTS}) << 464 message(FATAL_ERROR "Geant4 component ${_remaining} not found") 619 if(NOT Geant4_${_comp}_FOUND) << 465 elseif(NOT Geant4_FIND_QUIETLY) 620 if(Geant4_FIND_REQUIRED_${_comp}) << 466 message(WARNING " Geant4 component ${_remaining} not found") 621 message(WARNING "Geant4 required compone << 622 set(Geant4_FOUND FALSE) << 623 endif() << 624 endif() 467 endif() >> 468 unset(Geant4_FIND_REQUIRED_${_remaining}) 625 endforeach() 469 endforeach() 626 470 627 #--------------------------------------------- << 471 # And we should be done... 628 # Reporting via FindPackageHandleStandardArgs << 472 629 include(FindPackageHandleStandardArgs) << 630 set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE << 631 find_package_handle_standard_args(@PROJECT_NAM <<