Warning, /geant4/cmake/Templates/Geant4Config.cmake.in is written in an unsupported language. File is not indexed.
0001 # - Geant4 CMake Configuration File for External Projects
0002 # This file is configured by Geant4 for use by an external project
0003 # This file is configured by Geant4's CMake system and SHOULD NOT BE EDITED
0004 #
0005 # It defines the following variables
0006 # Geant4_INCLUDE_DIRS - include directories for Geant4
0007 # Geant4_LIBRARIES - libraries to link against
0008 # Geant4_BUILD_TYPE - Build type (e.g. "Release") used to build this
0009 # install. Only set if Geant4 was installed using
0010 # a single mode tool (e.g. make, ninja).
0011 # Geant4_CXX_FLAGS - Recommended CXX flags for the compiler used to
0012 # build the Geant4 libraries.
0013 # Geant4_CXX_FLAGS_<CONFIG> - Recommended CXX flags for build mode CONFIG.
0014 # Geant4_USE_FILE - path to a CMake module which may be included to
0015 # help setup CMake variables
0016 # Geant4_CXXSTD - C++ Standard used to compile Geant4, e.g. c++98
0017 # Geant4_TLS_MODEL - Thread Local Storage model used. Only set if
0018 # the build used an explicit model.
0019 #
0020 # You may supply a version number through find_package which will be checked
0021 # against the version of this build. Standard CMake logic is used so that
0022 # the EXACT flag may be passed, and otherwise this build will report itself
0023 # as compatible with the requested version if:
0024 #
0025 # VERSION_OF_THIS_BUILD >= VERSION_REQUESTED
0026 #
0027 # By default only the core (or kernel) of Geant4 is activated by this
0028 # module. You can specify additional components of Geant4 through the
0029 # COMPONENTS argument to find_package. By default, all core libraries of
0030 # Geant4 are appended to the Geant4_LIBRARIES variable. Specifying
0031 # additional components will enable a check on the existence of these
0032 # components, with the following per component variables being set:
0033 #
0034 # Geant4_${COMPONENT}_FOUND TRUE is the Geant4 library "component" was
0035 # found
0036 #
0037 # Geant4_${COMPONENT}_LIBRARY Contains the library for the specified
0038 # "component" IF the component is a library.
0039 #
0040 # In Geant4, components can be optional subcomponents of an always
0041 # available library. In that case there will be no
0042 # Geant4_{COMPONENT}_LIBRARY variable. These non-library components are
0043 # generally activated by compile definitions that are part of the target's
0044 # COMPILE_DEFINITIONS property.
0045 #
0046 # If you use the REQUIRED and/or COMPONENTS arguments of find_package to
0047 # specify components, then the module will issue a FATAL_ERROR if the
0048 # found Geant4 does not have the requested component(s). Any components
0049 # specified through the OPTIONAL_COMPONENTS argument will be enabled
0050 # only if the found Geant4 supports them, with no error being raised if
0051 # they are not supported.
0052 #
0053 # The components available generally correspond to configurations of
0054 # the Geant4 libraries or optional extras that Geant4 can be built with.
0055 #
0056 # Library Configuration
0057 # ---------------------
0058 # static (Static libraries available. Using this component
0059 # when static libraries are available will result in
0060 # Geant4_LIBRARIES being populated with the static
0061 # versions of the Geant4 libraries. It does not, and cannot,
0062 # guarantee the use of static third party libraries.)
0063 # multithreaded (Libraries are multithread capable)
0064 #
0065 # usolids (Geant4 solids are replaced with USolids equivalents)
0066 #
0067 # smartstack (G4event library G4StackManager uses G4SmartTrackStack)
0068 #
0069 # php_as_hp (G4processes library ParticleHP built as HP)
0070 #
0071 # Optional Components
0072 # -------------------
0073 # gdml (GDML support)
0074 # g3tog4 (Geant3 geometry call list reader library)
0075 # freetype (G4analysis library has freetype support)
0076 # hdf5 (G4analysis library has HDF5 support)
0077 #
0078 # ui_tcsh (TCsh Style Application Command Line Interface)
0079 # ui_win32 (WIN32 Style Application Command Line Interface)
0080 #
0081 # motif (Motif-X11/OpenGL Graphical User Interface)
0082 # qt (Qt/OpenGL Graphical User Interface)
0083 #
0084 # vis_Vtk (VTK Graphical User Interface)
0085 # vis_openinventor (OpenInventor visualization)
0086 # vis_opengl_x11 (OpenGL visualization with X11 interface)
0087 # vis_opengl_win32 (OpenGL visualization with X11 interface)
0088 # vis_raytracer_x11 (RayTracer visualization with X11 interface)
0089 #
0090 # In addition, two 'shorthand' components are defined to help activate all
0091 # available User Interface and Visualization drivers:
0092 #
0093 # ui_all (All available UI drivers)
0094 # vis_all (All available Vis drivers)
0095 #
0096 # These never result in a FATAL_ERROR, even if the REQUIRED find_package
0097 # argument is set. This is because these options do not depend on specific
0098 # components being available.
0099 #
0100 # You can also query whether the Geant4 found uses the builtin or system
0101 # versions of CLHEP, ZLIB, or Expat after calling find_package via the variables
0102 #
0103 # Geant4_builtin_clhep_FOUND (TRUE if Geant4 built with internal CLHEP)
0104 # Geant4_system_clhep_FOUND (TRUE if Geant4 built with external CLHEP)
0105 # Geant4_builtin_expat_FOUND (TRUE if Geant4 built with internal Expat)
0106 # Geant4_builtin_zlib_FOUND (TRUE if Geant4 built with internal Zlib)
0107 #
0108 # These are not used via components as they do not, in general, affect
0109 # the use of Geant4 in an application unless you yourself make direct
0110 # calls to these APIs. As the builtin libraries only contain the code
0111 # required directly by the Geant4 toolkit, you may wish to perform a
0112 # configure time check in these cases that the builtin libraries contain
0113 # the calls required. In both cases, the Geant4_INCLUDE_DIRS and
0114 # Geant4_LIBRARIES variables will be populated to use the builtin or
0115 # system APIs as required, and you should use these to ensure you compile
0116 # and link against the same API version.
0117 #
0118 # Environment variables for, and directory paths to, physics datasets
0119 # used by some Geant4 physics processes may be determined from the
0120 # variables
0121 #
0122 # Geant4_DATASETS (List of dataset names known to Geant4)
0123 # Geant4_DATASET_<NAME>_ENVVAR (Name of environment variable used by
0124 # Geant4 to obtain path to dataset
0125 # <NAME>)
0126 # Geant4_DATASET_<NAME>_PATH (Path to dataset <NAME>. NB this may
0127 # point to a non-existent path if Geant4
0128 # was configured not to install data)
0129 #
0130 #-----------------------------------------------------------------------
0131 # Variables used by this module which can change the default behaviour of
0132 # this module. They need to be set prior to the call to find_package
0133 #
0134 # Geant4_CONFIG_DEBUG If set, enable extra messaging output which can
0135 # be helpful in debugging and identifying problems
0136 # with the configuration.
0137 #
0138 #-----------------------------------------------------------------------
0139
0140 #-----------------------------------------------------------------------
0141 # DEBUG : print out the variables passed via find_package arguments
0142 #
0143 if(Geant4_CONFIG_DEBUG)
0144 message(STATUS "G4CFG_DEBUG : Geant4_VERSION = ${Geant4_VERSION}")
0145 message(STATUS "G4CFG_DEBUG : Geant4_FIND_VERSION = ${Geant4_FIND_VERSION}")
0146 message(STATUS "G4CFG_DEBUG : Geant4_FIND_REQUIRED = ${Geant4_FIND_REQUIRED}")
0147 message(STATUS "G4CFG_DEBUG : Geant4_FIND_COMPONENTS = ${Geant4_FIND_COMPONENTS}")
0148
0149 foreach(_cpt ${Geant4_FIND_COMPONENTS})
0150 message(STATUS "G4CFG_DEBUG : Geant4_FIND_REQUIRED_${_cpt} = ${Geant4_FIND_REQUIRED_${_cpt}}")
0151 endforeach()
0152
0153 message(STATUS "G4CFG_DEBUG : Geant4_LIBDEPS_LOADED = ${Geant4_LIBDEPS_LOADED}")
0154 endif()
0155
0156 #-----------------------------------------------------------------------
0157 # Check that consumers use the minimum needed CMake version
0158 # Geant4 uses cxx_std_EP to define the standard it was built against
0159 # 3.8 and above support EP=17. 3.12 and above add 20. 3.20 and above add 23.
0160 # We continue to support the earlier version whilst checking for consumers using 20
0161 cmake_policy(VERSION 3.8...3.18)
0162 if(CMAKE_VERSION VERSION_LESS 3.8)
0163 message(FATAL_ERROR "Projects consuming Geant4Config require CMake 3.8 or newer")
0164 endif()
0165
0166 if(("@CMAKE_CXX_STANDARD@" GREATER_EQUAL 23) AND (CMAKE_VERSION VERSION_LESS 3.20))
0167 message(FATAL_ERROR "Projects consuming Geant4Config require CMake 3.20 or newer (for C++23 support)")
0168 endif()
0169
0170 if(("@CMAKE_CXX_STANDARD@" GREATER_EQUAL 20) AND (CMAKE_VERSION VERSION_LESS 3.12))
0171 message(FATAL_ERROR "Projects consuming Geant4Config require CMake 3.12 or newer (for C++20 support)")
0172 endif()
0173
0174 # - Help find dependencies
0175 include(CMakeFindDependencyMacro)
0176
0177 #-----------------------------------------------------------------------
0178 # Locate ourselves, since all other config files should have been
0179 # installed alongside us...
0180 #
0181 get_filename_component(_geant4_thisdir "${CMAKE_CURRENT_LIST_FILE}" PATH)
0182
0183 #-----------------------------------------------------------------------
0184 # Provide *recommended* compiler flags used by this build of Geant4
0185 # Don't mess with the actual CMAKE_CXX_FLAGS!!!
0186 # It's up to the user what to do with these
0187 @GEANT4_COMPILER_FLAG_HINTS@
0188
0189 # - Provide variable indicating C++ Standard we were compiled against
0190 set(Geant4_CXX_STANDARD "@CMAKE_CXX_STANDARD@")
0191
0192 #-----------------------------------------------------------------------
0193 # Configure the path to the Geant4 headers, using a relative path if
0194 # possible. This is only known at CMake time, so we expand a CMake
0195 # supplied variable.
0196 #
0197 @GEANT4_INCLUDE_DIR_SETUP@
0198 set(Geant4_INCLUDE_DIRS "${Geant4_INCLUDE_DIR}")
0199
0200 # Push our own module path onto the CMake one to help refind dependencies
0201 # - Popped at end of this module
0202 list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}/Modules")
0203
0204 #-----------------------------------------------------------------------
0205 # Data Resources
0206 # NB: Because data paths can be "forward declared" these offer no
0207 # guarantee of data existence. They only provide a hint.
0208 #
0209 set(Geant4_DATASET_DESCRIPTIONS "@GEANT4_DATASET_DESCRIPTIONS@")
0210
0211 foreach(_g4dataset_tuple ${Geant4_DATASET_DESCRIPTIONS})
0212 # Format is NAME|ENVVAR|PATH
0213 string(REPLACE "|" ";" _g4dataset_tuple "${_g4dataset_tuple}")
0214 list(GET _g4dataset_tuple 0 _g4dataset_name)
0215 list(APPEND Geant4_DATASETS ${_g4dataset_name})
0216 list(GET _g4dataset_tuple 1 Geant4_DATASET_${_g4dataset_name}_ENVVAR)
0217 list(GET _g4dataset_tuple 2 Geant4_DATASET_${_g4dataset_name}_PATH)
0218 endforeach()
0219 unset(Geant4_DATASET_DESCRIPTIONS)
0220
0221 #-----------------------------------------------------------------------
0222 # Optional Build Components
0223 #-----------------------------------------------------------------------
0224 # - General Multithreading
0225 set(Geant4_multithreaded_FOUND @GEANT4_BUILD_MULTITHREADED@)
0226 if(Geant4_multithreaded_FOUND)
0227 # - Define variable to indicate TLS model used
0228 set(Geant4_TLS_MODEL "@GEANT4_BUILD_TLS_MODEL@")
0229 if(Geant4_TLS_MODEL STREQUAL "auto")
0230 unset(Geant4_TLS_MODEL)
0231 endif()
0232 endif()
0233
0234 # - Smart track stack
0235 set(Geant4_smartstack_FOUND @GEANT4_USE_SMARTSTACK@)
0236
0237 # - ParticleHP as HP
0238 set(Geant4_php_as_hp_FOUND @GEANT4_BUILD_PHP_AS_HP@)
0239
0240 # - G3toG4
0241 set(Geant4_g3tog4_FOUND @GEANT4_USE_G3TOG4@)
0242 if(Geant4_g3tog4_FOUND)
0243 if(Geant4_FIND_REQUIRED_g3tog4)
0244 set(_geant4_use_g3tog4_library ON)
0245 endif()
0246 endif()
0247
0248 #-----------------------------------------------------------------------
0249 # Optional Components that may depend on external packages
0250 #-----------------------------------------------------------------------
0251 # Optionally import build-time package settings to provide hard values
0252 # for find_package to work with
0253 include("${CMAKE_CURRENT_LIST_DIR}/Geant4PackageCache.cmake" OPTIONAL)
0254
0255 # - CLHEP
0256 set(Geant4_system_clhep_FOUND @GEANT4_USE_SYSTEM_CLHEP@)
0257 if(Geant4_system_clhep_FOUND)
0258 set(Geant4_builtin_clhep_FOUND FALSE)
0259 find_dependency(CLHEP @CLHEP_VERSION@ EXACT CONFIG)
0260 else()
0261 set(Geant4_builtin_clhep_FOUND TRUE)
0262 endif()
0263
0264 # - EXPAT
0265 set(Geant4_builtin_expat_FOUND @GEANT4_USE_BUILTIN_EXPAT@)
0266 if(NOT Geant4_builtin_expat_FOUND)
0267 find_dependency(EXPAT @EXPAT_VERSION_STRING@)
0268 include("${CMAKE_CURRENT_LIST_DIR}/G4EXPATShim.cmake")
0269 endif()
0270
0271 # - ZLIB
0272 set(Geant4_builtin_zlib_FOUND @GEANT4_USE_BUILTIN_ZLIB@)
0273 if(NOT Geant4_builtin_zlib_FOUND)
0274 find_dependency(ZLIB @ZLIB_VERSION_STRING@)
0275 endif()
0276
0277 # - PTL/TBB
0278 set(Geant4_system_ptl_FOUND @GEANT4_USE_SYSTEM_PTL@)
0279 set(Geant4_TBB_FOUND @GEANT4_USE_TBB@)
0280 if(Geant4_system_ptl_FOUND)
0281 set(Geant4_builtin_ptl_FOUND FALSE)
0282 if(Geant4_TBB_FOUND)
0283 find_dependency(PTL @PTL_VERSION@ COMPONENTS TBB)
0284 else()
0285 find_dependency(PTL @PTL_VERSION@)
0286 endif()
0287 else()
0288 # We know exactly where PTL is
0289 set(Geant4_builtin_ptl_FOUND TRUE)
0290 if(CMAKE_VERSION VERSION_GREATER 3.8.9999)
0291 find_dependency(PTL NO_DEFAULT_PATH PATHS "@PACKAGE_PTL_PREFIX@")
0292 else()
0293 find_package(PTL REQUIRED NO_DEFAULT_PATH PATHS "@PACKAGE_PTL_PREFIX@")
0294 endif()
0295 endif()
0296
0297 # - GDML
0298 set(Geant4_gdml_FOUND @GEANT4_USE_GDML@)
0299 if(Geant4_gdml_FOUND)
0300 find_dependency(XercesC @XercesC_VERSION@)
0301 endif()
0302
0303 # - VecGeom
0304 set(Geant4_usolids_FOUND @GEANT4_USE_USOLIDS_EITHER@)
0305 if(Geant4_usolids_FOUND)
0306 find_dependency(VecGeom @VecGeom_VERSION@)
0307 endif()
0308
0309 # - Freetype
0310 set(Geant4_freetype_FOUND @GEANT4_USE_FREETYPE@)
0311 if(Geant4_freetype_FOUND)
0312 find_dependency(Freetype @FREETYPE_VERSION_STRING@)
0313 include("${CMAKE_CURRENT_LIST_DIR}/G4FreetypeShim.cmake")
0314 endif()
0315
0316 # - HDF5
0317 set(Geant4_hdf5_FOUND @GEANT4_USE_HDF5@)
0318 if(Geant4_hdf5_FOUND)
0319 find_dependency(HDF5)
0320 include("${CMAKE_CURRENT_LIST_DIR}/G4HDF5Shim.cmake")
0321 endif()
0322
0323 #-----------------------------------------------------------------------
0324 # UI/VIS
0325 #
0326 # Prefer Legacy GL when using CMake >= 3.10
0327 set(OpenGL_GL_PREFERENCE_SAVE "${OpenGL_GL_PREFERENCE}")
0328 set(OpenGL_GL_PREFERENCE "LEGACY")
0329
0330 # - Helper variables for ui/vis_all components
0331 if("ui_all" IN_LIST Geant4_FIND_COMPONENTS)
0332 set(Geant4_ui_all_FOUND TRUE)
0333 endif()
0334
0335 if("vis_all" IN_LIST Geant4_FIND_COMPONENTS)
0336 set(Geant4_vis_all_FOUND TRUE)
0337 endif()
0338
0339 # - UI : TCSH
0340 set(Geant4_ui_tcsh_FOUND @UNIX@)
0341
0342 # - UI : win32
0343 set(Geant4_ui_win32_FOUND @WIN32@)
0344
0345 #-----------------------------------------------------------------------
0346 # Components which requires slightly more complex setup
0347 #
0348 # - Visualization : RayTracerX
0349 set(Geant4_vis_raytracer_x11_FOUND @GEANT4_USE_RAYTRACER_X11@)
0350 if(Geant4_vis_raytracer_x11_FOUND)
0351 find_dependency(X11)
0352 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
0353 endif()
0354
0355 # - Qt (UI and Vis!)
0356 set(Geant4_qt_FOUND @GEANT4_USE_QT@)
0357 set(Geant4_qt3d_FOUND @GEANT4_USE_QT3D@)
0358 if(Geant4_qt_FOUND)
0359 # Must always refind Qt to recreate imported targets. Because these
0360 # are in the public interface, always need linking.
0361 find_dependency(Qt@QT_VERSION_MAJOR@Core REQUIRED)
0362 find_dependency(Qt@QT_VERSION_MAJOR@Gui REQUIRED)
0363 find_dependency(Qt@QT_VERSION_MAJOR@Widgets REQUIRED)
0364 find_dependency(Qt@QT_VERSION_MAJOR@OpenGL REQUIRED)
0365 if(@QT_VERSION_MAJOR@ GREATER 5)
0366 find_dependency(Qt@QT_VERSION_MAJOR@OpenGLWidgets REQUIRED)
0367 endif()
0368
0369 if(Geant4_qt3d_FOUND)
0370 find_dependency(Qt@QT_VERSION_MAJOR@3DCore @QT3D_MINIMUM_VERSION@ REQUIRED)
0371 find_dependency(Qt@QT_VERSION_MAJOR@3DExtras @QT3D_MINIMUM_VERSION@ REQUIRED)
0372 find_dependency(Qt@QT_VERSION_MAJOR@3DRender @QT3D_MINIMUM_VERSION@ REQUIRED)
0373 endif()
0374
0375 # Also require OpenGL
0376 find_dependency(OpenGL)
0377
0378 # Qt must be activated both directly and for OpenInventor
0379 if(("qt" IN_LIST Geant4_FIND_COMPONENTS)
0380 OR ("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS)
0381 OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
0382 set(_geant4_use_opengl_library ON)
0383 # Qt3D is always on if available
0384 set(_geant4_use_qt3D_library ${Geant4_qt3d_FOUND})
0385 endif()
0386 endif()
0387
0388 # - Motif (UI and Vis!)
0389 set(Geant4_motif_FOUND @GEANT4_USE_XM@)
0390 if(Geant4_motif_FOUND)
0391 find_dependency(X11)
0392 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
0393 find_dependency(Motif)
0394 include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake")
0395 if(APPLE)
0396 find_dependency(XQuartzGL)
0397 else()
0398 find_dependency(OpenGL)
0399 endif()
0400
0401 # Motif can be activated both directly and for OpenInventor
0402 if(("motif" IN_LIST Geant4_FIND_COMPONENTS)
0403 OR ("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS)
0404 OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
0405 set(_geant4_use_opengl_library ON)
0406 endif()
0407 endif()
0408
0409 # - OpenGL X11
0410 set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OPENGL_X11@)
0411 if(Geant4_vis_opengl_x11_FOUND)
0412 find_dependency(X11)
0413 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
0414 if(APPLE)
0415 find_dependency(XQuartzGL)
0416 else()
0417 find_dependency(OpenGL)
0418 endif()
0419
0420 if(("vis_opengl_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
0421 set(_geant4_use_opengl_library ON)
0422 endif()
0423 endif()
0424
0425 # - OpenGL Win32
0426 set(Geant4_vis_opengl_win32_FOUND @GEANT4_USE_OPENGL_WIN32@)
0427 if(Geant4_vis_opengl_win32_FOUND)
0428 find_dependency(OpenGL)
0429 if(("vis_opengl_win32" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
0430 set(_geant4_use_opengl_library ON)
0431 endif()
0432 endif()
0433
0434 # - OpenInventor
0435 set(Geant4_vis_openinventor_FOUND @GEANT4_USE_INVENTOR@)
0436 set(Geant4_vis_openinventor_qt_FOUND @GEANT4_USE_INVENTOR_QT@)
0437 if(Geant4_vis_openinventor_FOUND)
0438 find_dependency(Coin)
0439
0440 if(Geant4_vis_openinventor_qt_FOUND)
0441 # Qt dependency handled by Geant4_vis_qt_FOUND earlier,
0442 # always ON if Inventor_QT is
0443 find_dependency(SoQt)
0444 else()
0445 if(WIN32)
0446 find_dependency(SoWin)
0447 else()
0448 # Motif/X11/GL dependency handled by Geant4_motif_FOUND earlier,
0449 # always ON if Inventor/Xt is.
0450 find_dependency(SoXt)
0451 endif()
0452 endif()
0453
0454 if(("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
0455 set(_geant4_use_inventor_library ON)
0456 endif()
0457 endif()
0458
0459 # Reset any OpenGL Preference
0460 set(OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFERENCE_SAVE}")
0461
0462 set(Geant4_vis_Vtk_FOUND @GEANT4_USE_VTK@)
0463 if(Geant4_vis_Vtk_FOUND)
0464 find_dependency(VTK 9 REQUIRED COMPONENTS
0465 CommonColor
0466 InteractionStyle
0467 IOExport
0468 GUISupportQt
0469 RenderingVolumeOpenGL2
0470 )
0471 set(_geant4_use_vtk_library ON)
0472 endif()
0473
0474 #-----------------------------------------------------------------------
0475 # Include the files listing all the imported targets and configuring
0476 # Intel/MSVC Compile Features
0477 # (Not needed if used in the same Geant4 project, or if we have run before)
0478 # This is always installed in the same location as us...
0479 #
0480 if(NOT CMAKE_PROJECT_NAME STREQUAL Geant4)
0481 include("${_geant4_thisdir}/Modules/IntelCompileFeatures.cmake")
0482 include("${_geant4_thisdir}/Modules/MSVCCompileFeatures.cmake")
0483
0484 if(NOT Geant4_LIBDEPS_LOADED)
0485 include("${_geant4_thisdir}/Geant4LibraryDepends.cmake")
0486 set(Geant4_LIBDEPS_LOADED 1)
0487 endif()
0488 endif()
0489
0490 #-----------------------------------------------------------------------
0491 # Now perform final configuration of libraries...
0492 # We provide FOUND variables for presence of shared and static
0493 # User can supply "static" component to force use of static libraries, if
0494 # available.
0495 set(Geant4_shared_FOUND @BUILD_SHARED_LIBS@)
0496 set(Geant4_static_FOUND @BUILD_STATIC_LIBS@)
0497
0498 # - Default setting : shared if available, static otherwise
0499 if(Geant4_shared_FOUND)
0500 set(_geant4_lib_use_suffix "")
0501 else()
0502 set(_geant4_lib_use_suffix "-static")
0503 endif()
0504
0505 if(("static" IN_LIST Geant4_FIND_COMPONENTS) AND Geant4_static_FOUND)
0506 set(_geant4_lib_use_suffix "-static")
0507 endif()
0508
0509 # The list of libraries probably should be autogenerated, but we hard code
0510 # for now. We don't have to divide the list of shared libraries, but we
0511 # do so for consistency with the way we'll need to do it for static.
0512 # - Always on Vis Components
0513 set(_geant4_internal_libraries
0514 Geant4::G4Tree${_geant4_lib_use_suffix}
0515 Geant4::G4FR${_geant4_lib_use_suffix}
0516 Geant4::G4GMocren${_geant4_lib_use_suffix}
0517 Geant4::G4visHepRep${_geant4_lib_use_suffix}
0518 Geant4::G4RayTracer${_geant4_lib_use_suffix}
0519 Geant4::G4VRML${_geant4_lib_use_suffix}
0520 Geant4::G4ToolsSG${_geant4_lib_use_suffix})
0521
0522 # - G4OpenGL if it's requested.
0523 if(_geant4_use_opengl_library)
0524 list(APPEND _geant4_internal_libraries Geant4::G4OpenGL${_geant4_lib_use_suffix})
0525 endif()
0526
0527 # - Qt3D if it's requested.
0528 if(_geant4_use_qt3D_library)
0529 list(APPEND _geant4_internal_libraries Geant4::G4visQt3D${_geant4_lib_use_suffix})
0530 endif()
0531
0532 # - G4OpenInventor if it's requested.
0533 if(_geant4_use_inventor_library)
0534 list(APPEND _geant4_internal_libraries Geant4::G4OpenInventor${_geant4_lib_use_suffix})
0535 endif()
0536
0537 if(_geant4_use_vtk_library)
0538 list(APPEND _geant4_internal_libraries Geant4::G4visVtk${_geant4_lib_use_suffix})
0539 endif()
0540
0541 # - GDML always added for now as old G4persistency lib always added if present
0542 if(Geant4_gdml_FOUND)
0543 set(_geant4_g4gdml_library Geant4::G4gdml${_geant4_lib_use_suffix})
0544 endif()
0545
0546 # - G3toG4 if it's requested
0547 if(_geant4_use_g3tog4_library)
0548 set(_geant4_g3tog4_library Geant4::G3toG4${_geant4_lib_use_suffix})
0549 endif()
0550
0551 set(_geant4_physicslists_library Geant4::G4physicslists${_geant4_lib_use_suffix})
0552
0553 # - 'Kernel' libraries
0554 list(APPEND _geant4_internal_libraries
0555 Geant4::G4vis_management${_geant4_lib_use_suffix}
0556 Geant4::G4modeling${_geant4_lib_use_suffix}
0557 Geant4::G4interfaces${_geant4_lib_use_suffix}
0558 Geant4::G4mctruth${_geant4_lib_use_suffix}
0559 Geant4::G4geomtext${_geant4_lib_use_suffix}
0560 ${_geant4_g4gdml_library}
0561 ${_geant4_g3tog4_library}
0562 Geant4::G4analysis${_geant4_lib_use_suffix}
0563 Geant4::G4error_propagation${_geant4_lib_use_suffix}
0564 Geant4::G4readout${_geant4_lib_use_suffix}
0565 ${_geant4_physicslists_library}
0566 Geant4::G4run${_geant4_lib_use_suffix}
0567 Geant4::G4event${_geant4_lib_use_suffix}
0568 Geant4::G4tracking${_geant4_lib_use_suffix}
0569 Geant4::G4parmodels${_geant4_lib_use_suffix}
0570 Geant4::G4processes${_geant4_lib_use_suffix}
0571 Geant4::G4digits_hits${_geant4_lib_use_suffix}
0572 Geant4::G4track${_geant4_lib_use_suffix}
0573 Geant4::G4particles${_geant4_lib_use_suffix}
0574 Geant4::G4geometry${_geant4_lib_use_suffix}
0575 Geant4::G4materials${_geant4_lib_use_suffix}
0576 Geant4::G4graphics_reps${_geant4_lib_use_suffix}
0577 Geant4::G4intercoms${_geant4_lib_use_suffix}
0578 Geant4::G4global${_geant4_lib_use_suffix}
0579 # G4tools is INTERFACE, so same for both static/shared.
0580 Geant4::G4tools
0581 )
0582
0583 # - Any externals built by Geant4
0584 foreach(_extlib @GEANT4_EXTERNALS_TARGETS@)
0585 list(APPEND
0586 _geant4_internal_libraries
0587 Geant4::${_extlib}${_geant4_lib_use_suffix}
0588 )
0589 endforeach()
0590
0591 # - Now set them to Geant4_LIBRARIES
0592 set(Geant4_LIBRARIES ${_geant4_internal_libraries})
0593
0594 #-----------------------------------------------------------------------
0595 # Remove any duplicates from the Geant4_{INCLUDE_DIRS,LIBRARIES}
0596 # variables so that multiple passes append things correctly
0597 #
0598 if(Geant4_INCLUDE_DIRS)
0599 list(REMOVE_DUPLICATES Geant4_INCLUDE_DIRS)
0600 endif()
0601
0602 if(Geant4_LIBRARIES)
0603 list(REMOVE_DUPLICATES Geant4_LIBRARIES)
0604 endif()
0605
0606 #-----------------------------------------------------------------------
0607 # Point the user to the UseGeant4.cmake file which they may wish to include
0608 # to help them with setting up Geant4
0609 #
0610 set(Geant4_USE_FILE "${_geant4_thisdir}/UseGeant4.cmake")
0611
0612 #-----------------------------------------------------------------------
0613 # Pop our custom module path from the CMake one
0614 list(REMOVE_AT CMAKE_MODULE_PATH 0)
0615
0616 #-----------------------------------------------------------------------
0617 # Check FOUNDness of required components.
0618 foreach(_comp ${Geant4_FIND_COMPONENTS})
0619 if(NOT Geant4_${_comp}_FOUND)
0620 if(Geant4_FIND_REQUIRED_${_comp})
0621 message(WARNING "Geant4 required component '${_comp}' not found")
0622 set(Geant4_FOUND FALSE)
0623 endif()
0624 endif()
0625 endforeach()
0626
0627 #-----------------------------------------------------------------------
0628 # Reporting via FindPackageHandleStandardArgs "CONFIG_MODE" to give a better message on being found
0629 include(FindPackageHandleStandardArgs)
0630 set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
0631 find_package_handle_standard_args(@PROJECT_NAME@ CONFIG_MODE)