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 if(Geant4_qt_FOUND)
0358 # Must always refind Qt to recreate imported targets. Because these
0359 # are in the public interface, always need linking.
0360 find_dependency(Qt@QT_VERSION_MAJOR@Core REQUIRED)
0361 find_dependency(Qt@QT_VERSION_MAJOR@Gui REQUIRED)
0362 find_dependency(Qt@QT_VERSION_MAJOR@Widgets REQUIRED)
0363 find_dependency(Qt@QT_VERSION_MAJOR@OpenGL REQUIRED)
0364 if(@QT_VERSION_MAJOR@ GREATER 5)
0365 find_dependency(Qt@QT_VERSION_MAJOR@OpenGLWidgets REQUIRED)
0366 endif()
0367
0368 # Also require OpenGL
0369 find_dependency(OpenGL)
0370
0371 # Qt must be activated both directly and for OpenInventor
0372 if(("qt" IN_LIST Geant4_FIND_COMPONENTS)
0373 OR ("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS)
0374 OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
0375 set(_geant4_use_opengl_library ON)
0376 endif()
0377 endif()
0378
0379 # - Motif (UI and Vis!)
0380 set(Geant4_motif_FOUND @GEANT4_USE_XM@)
0381 if(Geant4_motif_FOUND)
0382 find_dependency(X11)
0383 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
0384 find_dependency(Motif)
0385 include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake")
0386 if(APPLE)
0387 find_dependency(XQuartzGL)
0388 else()
0389 find_dependency(OpenGL)
0390 endif()
0391
0392 # Motif can be activated both directly and for OpenInventor
0393 if(("motif" IN_LIST Geant4_FIND_COMPONENTS)
0394 OR ("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS)
0395 OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
0396 set(_geant4_use_opengl_library ON)
0397 endif()
0398 endif()
0399
0400 # - OpenGL X11
0401 set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OPENGL_X11@)
0402 if(Geant4_vis_opengl_x11_FOUND)
0403 find_dependency(X11)
0404 include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
0405 if(APPLE)
0406 find_dependency(XQuartzGL)
0407 else()
0408 find_dependency(OpenGL)
0409 endif()
0410
0411 if(("vis_opengl_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
0412 set(_geant4_use_opengl_library ON)
0413 endif()
0414 endif()
0415
0416 # - OpenGL Win32
0417 set(Geant4_vis_opengl_win32_FOUND @GEANT4_USE_OPENGL_WIN32@)
0418 if(Geant4_vis_opengl_win32_FOUND)
0419 find_dependency(OpenGL)
0420 if(("vis_opengl_win32" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
0421 set(_geant4_use_opengl_library ON)
0422 endif()
0423 endif()
0424
0425 # - OpenInventor
0426 set(Geant4_vis_openinventor_FOUND @GEANT4_USE_INVENTOR@)
0427 set(Geant4_vis_openinventor_qt_FOUND @GEANT4_USE_INVENTOR_QT@)
0428 if(Geant4_vis_openinventor_FOUND)
0429 find_dependency(Coin)
0430
0431 if(Geant4_vis_openinventor_qt_FOUND)
0432 # Qt dependency handled by Geant4_vis_qt_FOUND earlier,
0433 # always ON if Inventor_QT is
0434 find_dependency(SoQt)
0435 else()
0436 if(WIN32)
0437 find_dependency(SoWin)
0438 else()
0439 # Motif/X11/GL dependency handled by Geant4_motif_FOUND earlier,
0440 # always ON if Inventor/Xt is.
0441 find_dependency(SoXt)
0442 endif()
0443 endif()
0444
0445 if(("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
0446 set(_geant4_use_inventor_library ON)
0447 endif()
0448 endif()
0449
0450 # Reset any OpenGL Preference
0451 set(OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFERENCE_SAVE}")
0452
0453 set(Geant4_vis_Vtk_FOUND @GEANT4_USE_VTK@)
0454 if(Geant4_vis_Vtk_FOUND)
0455 find_dependency(VTK 9 REQUIRED COMPONENTS
0456 CommonColor
0457 InteractionStyle
0458 IOExport
0459 GUISupportQt
0460 RenderingVolumeOpenGL2
0461 )
0462 set(_geant4_use_vtk_library ON)
0463 endif()
0464
0465 #-----------------------------------------------------------------------
0466 # Include the files listing all the imported targets and configuring
0467 # Intel/MSVC Compile Features
0468 # (Not needed if used in the same Geant4 project, or if we have run before)
0469 # This is always installed in the same location as us...
0470 #
0471 if(NOT CMAKE_PROJECT_NAME STREQUAL Geant4)
0472 include("${_geant4_thisdir}/Modules/IntelCompileFeatures.cmake")
0473 include("${_geant4_thisdir}/Modules/MSVCCompileFeatures.cmake")
0474
0475 if(NOT Geant4_LIBDEPS_LOADED)
0476 include("${_geant4_thisdir}/Geant4LibraryDepends.cmake")
0477 set(Geant4_LIBDEPS_LOADED 1)
0478 endif()
0479 endif()
0480
0481 #-----------------------------------------------------------------------
0482 # Now perform final configuration of libraries...
0483 # We provide FOUND variables for presence of shared and static
0484 # User can supply "static" component to force use of static libraries, if
0485 # available.
0486 set(Geant4_shared_FOUND @BUILD_SHARED_LIBS@)
0487 set(Geant4_static_FOUND @BUILD_STATIC_LIBS@)
0488
0489 # - Default setting : shared if available, static otherwise
0490 if(Geant4_shared_FOUND)
0491 set(_geant4_lib_use_suffix "")
0492 else()
0493 set(_geant4_lib_use_suffix "-static")
0494 endif()
0495
0496 if(("static" IN_LIST Geant4_FIND_COMPONENTS) AND Geant4_static_FOUND)
0497 set(_geant4_lib_use_suffix "-static")
0498 endif()
0499
0500 # The list of libraries probably should be autogenerated, but we hard code
0501 # for now. We don't have to divide the list of shared libraries, but we
0502 # do so for consistency with the way we'll need to do it for static.
0503 # - Always on Vis Components
0504 set(_geant4_internal_libraries
0505 Geant4::G4Tree${_geant4_lib_use_suffix}
0506 Geant4::G4FR${_geant4_lib_use_suffix}
0507 Geant4::G4GMocren${_geant4_lib_use_suffix}
0508 Geant4::G4RayTracer${_geant4_lib_use_suffix}
0509 Geant4::G4VRML${_geant4_lib_use_suffix}
0510 Geant4::G4ToolsSG${_geant4_lib_use_suffix})
0511
0512 # - G4OpenGL if it's requested.
0513 if(_geant4_use_opengl_library)
0514 list(APPEND _geant4_internal_libraries Geant4::G4OpenGL${_geant4_lib_use_suffix})
0515 endif()
0516
0517 # - G4OpenInventor if it's requested.
0518 if(_geant4_use_inventor_library)
0519 list(APPEND _geant4_internal_libraries Geant4::G4OpenInventor${_geant4_lib_use_suffix})
0520 endif()
0521
0522 if(_geant4_use_vtk_library)
0523 list(APPEND _geant4_internal_libraries Geant4::G4visVtk${_geant4_lib_use_suffix})
0524 endif()
0525
0526 # - GDML always added for now as old G4persistency lib always added if present
0527 if(Geant4_gdml_FOUND)
0528 set(_geant4_g4gdml_library Geant4::G4gdml${_geant4_lib_use_suffix})
0529 endif()
0530
0531 # - G3toG4 if it's requested
0532 if(_geant4_use_g3tog4_library)
0533 set(_geant4_g3tog4_library Geant4::G3toG4${_geant4_lib_use_suffix})
0534 endif()
0535
0536 set(_geant4_physicslists_library Geant4::G4physicslists${_geant4_lib_use_suffix})
0537
0538 # - 'Kernel' libraries
0539 list(APPEND _geant4_internal_libraries
0540 Geant4::G4vis_management${_geant4_lib_use_suffix}
0541 Geant4::G4modeling${_geant4_lib_use_suffix}
0542 Geant4::G4interfaces${_geant4_lib_use_suffix}
0543 Geant4::G4mctruth${_geant4_lib_use_suffix}
0544 Geant4::G4geomtext${_geant4_lib_use_suffix}
0545 ${_geant4_g4gdml_library}
0546 ${_geant4_g3tog4_library}
0547 Geant4::G4analysis${_geant4_lib_use_suffix}
0548 Geant4::G4error_propagation${_geant4_lib_use_suffix}
0549 Geant4::G4readout${_geant4_lib_use_suffix}
0550 ${_geant4_physicslists_library}
0551 Geant4::G4run${_geant4_lib_use_suffix}
0552 Geant4::G4event${_geant4_lib_use_suffix}
0553 Geant4::G4tracking${_geant4_lib_use_suffix}
0554 Geant4::G4parmodels${_geant4_lib_use_suffix}
0555 Geant4::G4processes${_geant4_lib_use_suffix}
0556 Geant4::G4digits_hits${_geant4_lib_use_suffix}
0557 Geant4::G4track${_geant4_lib_use_suffix}
0558 Geant4::G4particles${_geant4_lib_use_suffix}
0559 Geant4::G4geometry${_geant4_lib_use_suffix}
0560 Geant4::G4materials${_geant4_lib_use_suffix}
0561 Geant4::G4graphics_reps${_geant4_lib_use_suffix}
0562 Geant4::G4intercoms${_geant4_lib_use_suffix}
0563 Geant4::G4global${_geant4_lib_use_suffix}
0564 # G4tools is INTERFACE, so same for both static/shared.
0565 Geant4::G4tools
0566 )
0567
0568 # - Any externals built by Geant4
0569 foreach(_extlib @GEANT4_EXTERNALS_TARGETS@)
0570 list(APPEND
0571 _geant4_internal_libraries
0572 Geant4::${_extlib}${_geant4_lib_use_suffix}
0573 )
0574 endforeach()
0575
0576 # - Now set them to Geant4_LIBRARIES
0577 set(Geant4_LIBRARIES ${_geant4_internal_libraries})
0578
0579 #-----------------------------------------------------------------------
0580 # Remove any duplicates from the Geant4_{INCLUDE_DIRS,LIBRARIES}
0581 # variables so that multiple passes append things correctly
0582 #
0583 if(Geant4_INCLUDE_DIRS)
0584 list(REMOVE_DUPLICATES Geant4_INCLUDE_DIRS)
0585 endif()
0586
0587 if(Geant4_LIBRARIES)
0588 list(REMOVE_DUPLICATES Geant4_LIBRARIES)
0589 endif()
0590
0591 #-----------------------------------------------------------------------
0592 # Point the user to the UseGeant4.cmake file which they may wish to include
0593 # to help them with setting up Geant4
0594 #
0595 set(Geant4_USE_FILE "${_geant4_thisdir}/UseGeant4.cmake")
0596
0597 #-----------------------------------------------------------------------
0598 # Pop our custom module path from the CMake one
0599 list(REMOVE_AT CMAKE_MODULE_PATH 0)
0600
0601 #-----------------------------------------------------------------------
0602 # Check FOUNDness of required components.
0603 foreach(_comp ${Geant4_FIND_COMPONENTS})
0604 if(NOT Geant4_${_comp}_FOUND)
0605 if(Geant4_FIND_REQUIRED_${_comp})
0606 message(WARNING "Geant4 required component '${_comp}' not found")
0607 set(Geant4_FOUND FALSE)
0608 endif()
0609 endif()
0610 endforeach()
0611
0612 #-----------------------------------------------------------------------
0613 # Reporting via FindPackageHandleStandardArgs "CONFIG_MODE" to give a better message on being found
0614 include(FindPackageHandleStandardArgs)
0615 set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
0616 find_package_handle_standard_args(@PROJECT_NAME@ CONFIG_MODE)