Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/cmake/Templates/Geant4Config.cmake.in

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /cmake/Templates/Geant4Config.cmake.in (Version 11.3.0) and /cmake/Templates/Geant4Config.cmake.in (Version 11.2)


  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_LIBRARIES    - libraries to link aga      7 #  Geant4_LIBRARIES    - libraries to link against
  8 #  Geant4_BUILD_TYPE   - Build type (e.g. "Rel      8 #  Geant4_BUILD_TYPE   - Build type (e.g. "Release") used to build this
  9 #                        install. Only set if       9 #                        install. Only set if Geant4 was installed using
 10 #                        a single mode tool (e     10 #                        a single mode tool (e.g. make, ninja).
 11 #  Geant4_CXX_FLAGS    - Recommended CXX flags     11 #  Geant4_CXX_FLAGS    - Recommended CXX flags for the compiler used to
 12 #                        build the Geant4 libr     12 #                        build the Geant4 libraries.
 13 #  Geant4_CXX_FLAGS_<CONFIG> - Recommended CXX     13 #  Geant4_CXX_FLAGS_<CONFIG> - Recommended CXX flags for build mode CONFIG.
 14 #  Geant4_USE_FILE     - path to a CMake modul     14 #  Geant4_USE_FILE     - path to a CMake module which may be included to
 15 #                        help setup CMake vari     15 #                        help setup CMake variables
 16 #  Geant4_CXXSTD       - C++ Standard used to      16 #  Geant4_CXXSTD       - C++ Standard used to compile Geant4, e.g. c++98
 17 #  Geant4_TLS_MODEL    - Thread Local Storage      17 #  Geant4_TLS_MODEL    - Thread Local Storage model used. Only set if
 18 #                        the build used an exp     18 #                        the build used an explicit model.
 19 #                                                  19 #
 20 # You may supply a version number through find     20 # You may supply a version number through find_package which will be checked
 21 # against the version of this build. Standard      21 # against the version of this build. Standard CMake logic is used so that
 22 # the EXACT flag may be passed, and otherwise      22 # the EXACT flag may be passed, and otherwise this build will report itself
 23 # as compatible with the requested version if:     23 # as compatible with the requested version if:
 24 #                                                  24 #
 25 #  VERSION_OF_THIS_BUILD >= VERSION_REQUESTED      25 #  VERSION_OF_THIS_BUILD >= VERSION_REQUESTED
 26 #                                                  26 #
 27 # By default only the core (or kernel) of Gean     27 # By default only the core (or kernel) of Geant4 is activated by this
 28 # module. You can specify additional component     28 # module. You can specify additional components of Geant4 through the
 29 # COMPONENTS argument to find_package. By defa     29 # COMPONENTS argument to find_package. By default, all core libraries of
 30 # Geant4 are appended to the Geant4_LIBRARIES      30 # Geant4 are appended to the Geant4_LIBRARIES variable. Specifying
 31 # additional components will enable a check on     31 # additional components will enable a check on the existence of these
 32 # components, with the following per component     32 # components, with the following per component variables being set:
 33 #                                                  33 #
 34 #  Geant4_${COMPONENT}_FOUND    TRUE is the Ge     34 #  Geant4_${COMPONENT}_FOUND    TRUE is the Geant4 library "component" was
 35 #                               found              35 #                               found
 36 #                                                  36 #
 37 #  Geant4_${COMPONENT}_LIBRARY  Contains the l     37 #  Geant4_${COMPONENT}_LIBRARY  Contains the library for the specified
 38 #                               "component" IF     38 #                               "component" IF the component is a library.
 39 #                                                  39 #
 40 # In Geant4, components can be optional subcom     40 # In Geant4, components can be optional subcomponents of an always
 41 # available library. In that case there will b     41 # available library. In that case there will be no
 42 # Geant4_{COMPONENT}_LIBRARY variable. These n     42 # Geant4_{COMPONENT}_LIBRARY variable. These non-library components are
 43 # generally activated by compile definitions t     43 # generally activated by compile definitions that are part of the target's
 44 # COMPILE_DEFINITIONS property.                    44 # COMPILE_DEFINITIONS property.
 45 #                                                  45 #
 46 # If you use the REQUIRED and/or COMPONENTS ar     46 # If you use the REQUIRED and/or COMPONENTS arguments of find_package to
 47 # specify components, then the module will iss     47 # specify components, then the module will issue a FATAL_ERROR if the
 48 # found Geant4 does not have the requested com     48 # found Geant4 does not have the requested component(s). Any components
 49 # specified through the OPTIONAL_COMPONENTS ar     49 # specified through the OPTIONAL_COMPONENTS argument will be enabled
 50 # only if the found Geant4 supports them, with     50 # only if the found Geant4 supports them, with no error being raised if
 51 # they are not supported.                          51 # they are not supported.
 52 #                                                  52 #
 53 # The components available generally correspon     53 # The components available generally correspond to configurations of
 54 # the Geant4 libraries or optional extras that     54 # the Geant4 libraries or optional extras that Geant4 can be built with.
 55 #                                                  55 #
 56 # Library Configuration                            56 # Library Configuration
 57 # ---------------------                            57 # ---------------------
 58 #  static            (Static libraries availab     58 #  static            (Static libraries available. Using this component
 59 #                     when static libraries ar     59 #                     when static libraries are available will result in
 60 #                     Geant4_LIBRARIES being p     60 #                     Geant4_LIBRARIES being populated with the static
 61 #                     versions of the Geant4 l     61 #                     versions of the Geant4 libraries. It does not, and cannot,
 62 #                     guarantee the use of sta     62 #                     guarantee the use of static third party libraries.)
 63 #  multithreaded     (Libraries are multithrea     63 #  multithreaded     (Libraries are multithread capable)
 64 #                                                  64 #
 65 #  usolids           (Geant4 solids are replac     65 #  usolids           (Geant4 solids are replaced with USolids equivalents)
 66 #                                                  66 #
 67 #  smartstack        (G4event library G4StackM     67 #  smartstack        (G4event library G4StackManager uses G4SmartTrackStack)
 68 #                                                  68 #
 69 #  php_as_hp         (G4processes library Part     69 #  php_as_hp         (G4processes library ParticleHP built as HP)
 70 #                                                  70 #
 71 # Optional Components                              71 # Optional Components
 72 # -------------------                              72 # -------------------
 73 #  gdml              (GDML support)                73 #  gdml              (GDML support)
 74 #  g3tog4            (Geant3 geometry call lis     74 #  g3tog4            (Geant3 geometry call list reader library)
 75 #  freetype          (G4analysis library has f     75 #  freetype          (G4analysis library has freetype support)
 76 #  hdf5              (G4analysis library has H     76 #  hdf5              (G4analysis library has HDF5 support)
 77 #                                                  77 #
 78 #  ui_tcsh           (TCsh Style Application C     78 #  ui_tcsh           (TCsh Style Application Command Line Interface)
 79 #  ui_win32          (WIN32 Style Application      79 #  ui_win32          (WIN32 Style Application Command Line Interface)
 80 #                                                  80 #
 81 #  motif             (Motif-X11/OpenGL Graphic     81 #  motif             (Motif-X11/OpenGL Graphical User Interface)
 82 #  qt                (Qt/OpenGL Graphical User     82 #  qt                (Qt/OpenGL Graphical User Interface)
 83 #                                                  83 #
 84 #  vis_Vtk           (VTK Graphical User Inter << 
 85 #  vis_openinventor  (OpenInventor visualizati << 
 86 #  vis_opengl_x11    (OpenGL visualization wit     84 #  vis_opengl_x11    (OpenGL visualization with X11 interface)
 87 #  vis_opengl_win32  (OpenGL visualization wit     85 #  vis_opengl_win32  (OpenGL visualization with X11 interface)
 88 #  vis_raytracer_x11 (RayTracer visualization      86 #  vis_raytracer_x11 (RayTracer visualization with X11 interface)
                                                   >>  87 #  vis_openinventor  (OpenInventor visualization)
                                                   >>  88 #
                                                   >>  89 #  vis_toolssg_x11_gles     (ToolsSG visualization with X11 windowing and GLES rendering)
                                                   >>  90 #  vis_toolssg_xt_gles      (ToolsSG visualization with Xt windowing and GLES rendering)
                                                   >>  91 #  vis_toolssg_qt_gles      (ToolsSG visualization with Qt windowing and GLES rendering)
                                                   >>  92 #  vis_toolssg_windows_gles (ToolsSG visualization with Windows windowing and GLES rendering)
                                                   >>  93 
                                                   >>  94 #  vis_toolssg_x11_zb       (ToolsSG visualization with X11 windowing and g4tools zbuffer rendering)
                                                   >>  95 #  vis_toolssg_xt_zb        (ToolsSG visualization with Xt windowing and g4tools zbuffer rendering)
                                                   >>  96 #  vis_toolssg_qt_zb        (ToolsSG visualization with Qt windowing and g4tools zbuffer rendering)
                                                   >>  97 #  vis_toolssg_windows_zb   (ToolsSG visualization with Windows windowing and g4tools zbuffer rendering)
 89 #                                                  98 #
 90 # In addition, two 'shorthand' components are      99 # In addition, two 'shorthand' components are defined to help activate all
 91 # available User Interface and Visualization d    100 # available User Interface and Visualization drivers:
 92 #                                                 101 #
 93 #  ui_all            (All available UI drivers    102 #  ui_all            (All available UI drivers)
 94 #  vis_all           (All available Vis driver    103 #  vis_all           (All available Vis drivers)
 95 #                                                 104 #
 96 # These never result in a FATAL_ERROR, even if    105 # These never result in a FATAL_ERROR, even if the REQUIRED find_package
 97 # argument is set. This is because these optio    106 # argument is set. This is because these options do not depend on specific
 98 # components being available.                     107 # components being available.
 99 #                                                 108 #
100 # You can also query whether the Geant4 found     109 # You can also query whether the Geant4 found uses the builtin or system
101 # versions of CLHEP, ZLIB, or Expat after call    110 # versions of CLHEP, ZLIB, or Expat after calling find_package via the variables
102 #                                                 111 #
103 #  Geant4_builtin_clhep_FOUND   (TRUE if Geant    112 #  Geant4_builtin_clhep_FOUND   (TRUE if Geant4 built with internal CLHEP)
104 #  Geant4_system_clhep_FOUND    (TRUE if Geant    113 #  Geant4_system_clhep_FOUND    (TRUE if Geant4 built with external CLHEP)
105 #  Geant4_builtin_expat_FOUND   (TRUE if Geant    114 #  Geant4_builtin_expat_FOUND   (TRUE if Geant4 built with internal Expat)
106 #  Geant4_builtin_zlib_FOUND    (TRUE if Geant    115 #  Geant4_builtin_zlib_FOUND    (TRUE if Geant4 built with internal Zlib)
107 #                                                 116 #
108 # These are not used via components as they do    117 # These are not used via components as they do not, in general, affect
109 # the use of Geant4 in an application unless y    118 # the use of Geant4 in an application unless you yourself make direct
110 # calls to these APIs. As the builtin librarie    119 # calls to these APIs. As the builtin libraries only contain the code
111 # required directly by the Geant4 toolkit, you    120 # required directly by the Geant4 toolkit, you may wish to perform a
112 # configure time check in these cases that the    121 # configure time check in these cases that the builtin libraries contain
113 # the calls required. In both cases, the Geant    122 # the calls required. In both cases, the Geant4_INCLUDE_DIRS and
114 # Geant4_LIBRARIES variables will be populated    123 # Geant4_LIBRARIES variables will be populated to use the builtin or
115 # system APIs as required, and you should use     124 # system APIs as required, and you should use these to ensure you compile
116 # and link against the same API version.          125 # and link against the same API version.
117 #                                                 126 #
118 # Environment variables for, and directory pat    127 # Environment variables for, and directory paths to, physics datasets
119 # used by some Geant4 physics processes may be    128 # used by some Geant4 physics processes may be determined from the
120 # variables                                       129 # variables
121 #                                                 130 #
122 #  Geant4_DATASETS               (List of data    131 #  Geant4_DATASETS               (List of dataset names known to Geant4)
123 #  Geant4_DATASET_<NAME>_ENVVAR  (Name of envi    132 #  Geant4_DATASET_<NAME>_ENVVAR  (Name of environment variable used by
124 #                                 Geant4 to ob    133 #                                 Geant4 to obtain path to dataset
125 #                                 <NAME>)         134 #                                 <NAME>)
126 #  Geant4_DATASET_<NAME>_PATH    (Path to data    135 #  Geant4_DATASET_<NAME>_PATH    (Path to dataset <NAME>. NB this may
127 #                                 point to a n    136 #                                 point to a non-existent path if Geant4
128 #                                 was configur    137 #                                 was configured not to install data)
129 #                                                 138 #
130 #---------------------------------------------    139 #-----------------------------------------------------------------------
131 # Variables used by this module which can chan    140 # Variables used by this module which can change the default behaviour of
132 # this module. They need to be set prior to th    141 # this module. They need to be set prior to the call to find_package
133 #                                                 142 #
134 #  Geant4_CONFIG_DEBUG    If set, enable extra    143 #  Geant4_CONFIG_DEBUG    If set, enable extra messaging output which can
135 #                         be helpful in debugg    144 #                         be helpful in debugging and identifying problems
136 #                         with the configurati    145 #                         with the configuration.
137 #                                                 146 #
138 #---------------------------------------------    147 #-----------------------------------------------------------------------
139                                                   148 
140 #---------------------------------------------    149 #-----------------------------------------------------------------------
141 # DEBUG : print out the variables passed via f    150 # DEBUG : print out the variables passed via find_package arguments
142 #                                                 151 #
143 if(Geant4_CONFIG_DEBUG)                           152 if(Geant4_CONFIG_DEBUG)
144   message(STATUS "G4CFG_DEBUG : Geant4_VERSION    153   message(STATUS "G4CFG_DEBUG : Geant4_VERSION         = ${Geant4_VERSION}")
145   message(STATUS "G4CFG_DEBUG : Geant4_FIND_VE    154   message(STATUS "G4CFG_DEBUG : Geant4_FIND_VERSION    = ${Geant4_FIND_VERSION}")
146   message(STATUS "G4CFG_DEBUG : Geant4_FIND_RE    155   message(STATUS "G4CFG_DEBUG : Geant4_FIND_REQUIRED   = ${Geant4_FIND_REQUIRED}")
147   message(STATUS "G4CFG_DEBUG : Geant4_FIND_CO    156   message(STATUS "G4CFG_DEBUG : Geant4_FIND_COMPONENTS = ${Geant4_FIND_COMPONENTS}")
148                                                   157 
149   foreach(_cpt ${Geant4_FIND_COMPONENTS})         158   foreach(_cpt ${Geant4_FIND_COMPONENTS})
150     message(STATUS "G4CFG_DEBUG : Geant4_FIND_    159     message(STATUS "G4CFG_DEBUG : Geant4_FIND_REQUIRED_${_cpt} = ${Geant4_FIND_REQUIRED_${_cpt}}")
151   endforeach()                                    160   endforeach()
152                                                   161 
153   message(STATUS "G4CFG_DEBUG : Geant4_LIBDEPS    162   message(STATUS "G4CFG_DEBUG : Geant4_LIBDEPS_LOADED = ${Geant4_LIBDEPS_LOADED}")
154 endif()                                           163 endif()
155                                                   164 
156 #---------------------------------------------    165 #-----------------------------------------------------------------------
157 # Check that consumers use the minimum needed     166 # Check that consumers use the minimum needed CMake version
158 # Geant4 uses cxx_std_EP to define the standar    167 # 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     168 # 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    169 # We continue to support the earlier version whilst checking for consumers using 20
161 cmake_policy(VERSION 3.8...3.18)                  170 cmake_policy(VERSION 3.8...3.18)
162 if(CMAKE_VERSION VERSION_LESS 3.8)                171 if(CMAKE_VERSION VERSION_LESS 3.8)
163   message(FATAL_ERROR "Projects consuming Gean    172   message(FATAL_ERROR "Projects consuming Geant4Config require CMake 3.8 or newer")
164 endif()                                           173 endif()
165                                                   174 
166 if(("@CMAKE_CXX_STANDARD@" GREATER_EQUAL 23) A    175 if(("@CMAKE_CXX_STANDARD@" GREATER_EQUAL 23) AND (CMAKE_VERSION VERSION_LESS 3.20))
167   message(FATAL_ERROR "Projects consuming Gean    176   message(FATAL_ERROR "Projects consuming Geant4Config require CMake 3.20 or newer (for C++23 support)")
168 endif()                                           177 endif()
169                                                   178 
170 if(("@CMAKE_CXX_STANDARD@" GREATER_EQUAL 20) A    179 if(("@CMAKE_CXX_STANDARD@" GREATER_EQUAL 20) AND (CMAKE_VERSION VERSION_LESS 3.12))
171   message(FATAL_ERROR "Projects consuming Gean    180   message(FATAL_ERROR "Projects consuming Geant4Config require CMake 3.12 or newer (for C++20 support)")
172 endif()                                           181 endif()
173                                                   182 
174 # - Help find dependencies                        183 # - Help find dependencies
175 include(CMakeFindDependencyMacro)                 184 include(CMakeFindDependencyMacro)
176                                                   185 
177 #---------------------------------------------    186 #-----------------------------------------------------------------------
178 # Locate ourselves, since all other config fil    187 # Locate ourselves, since all other config files should have been
179 # installed alongside us...                       188 # installed alongside us...
180 #                                                 189 #
181 get_filename_component(_geant4_thisdir "${CMAK    190 get_filename_component(_geant4_thisdir "${CMAKE_CURRENT_LIST_FILE}" PATH)
182                                                   191 
183 #---------------------------------------------    192 #-----------------------------------------------------------------------
184 # Provide *recommended* compiler flags used by    193 # Provide *recommended* compiler flags used by this build of Geant4
185 # Don't mess with the actual CMAKE_CXX_FLAGS!!    194 # Don't mess with the actual CMAKE_CXX_FLAGS!!!
186 # It's up to the user what to do with these       195 # It's up to the user what to do with these
187 @GEANT4_COMPILER_FLAG_HINTS@                      196 @GEANT4_COMPILER_FLAG_HINTS@
188                                                   197 
189 # - Provide variable indicating C++ Standard w    198 # - Provide variable indicating C++ Standard we were compiled against
190 set(Geant4_CXX_STANDARD "@CMAKE_CXX_STANDARD@"    199 set(Geant4_CXX_STANDARD "@CMAKE_CXX_STANDARD@")
191                                                   200 
192 #---------------------------------------------    201 #-----------------------------------------------------------------------
193 # Configure the path to the Geant4 headers, us    202 # Configure the path to the Geant4 headers, using a relative path if
194 # possible. This is only known at CMake time,     203 # possible. This is only known at CMake time, so we expand a CMake
195 # supplied variable.                              204 # supplied variable.
196 #                                                 205 #
197 @GEANT4_INCLUDE_DIR_SETUP@                        206 @GEANT4_INCLUDE_DIR_SETUP@
198 set(Geant4_INCLUDE_DIRS "${Geant4_INCLUDE_DIR}    207 set(Geant4_INCLUDE_DIRS "${Geant4_INCLUDE_DIR}")
199                                                   208 
200 # Push our own module path onto the CMake one     209 # Push our own module path onto the CMake one to help refind dependencies
201 # - Popped at end of this module                  210 # - Popped at end of this module
202 list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRE    211 list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}/Modules")
203                                                   212 
204 #---------------------------------------------    213 #-----------------------------------------------------------------------
205 # Data Resources                                  214 # Data Resources
206 # NB: Because data paths can be "forward decla    215 # NB: Because data paths can be "forward declared" these offer no
207 # guarantee of data existence. They only provi    216 # guarantee of data existence. They only provide a hint.
208 #                                                 217 #
209 set(Geant4_DATASET_DESCRIPTIONS "@GEANT4_DATAS    218 set(Geant4_DATASET_DESCRIPTIONS "@GEANT4_DATASET_DESCRIPTIONS@")
210                                                   219 
211 foreach(_g4dataset_tuple ${Geant4_DATASET_DESC    220 foreach(_g4dataset_tuple ${Geant4_DATASET_DESCRIPTIONS})
212   # Format is NAME|ENVVAR|PATH                    221   # Format is NAME|ENVVAR|PATH
213   string(REPLACE "|" ";" _g4dataset_tuple "${_    222   string(REPLACE "|" ";" _g4dataset_tuple "${_g4dataset_tuple}")
214   list(GET _g4dataset_tuple 0 _g4dataset_name)    223   list(GET _g4dataset_tuple 0 _g4dataset_name)
215   list(APPEND Geant4_DATASETS ${_g4dataset_nam    224   list(APPEND Geant4_DATASETS ${_g4dataset_name})
216   list(GET _g4dataset_tuple 1 Geant4_DATASET_$    225   list(GET _g4dataset_tuple 1 Geant4_DATASET_${_g4dataset_name}_ENVVAR)
217   list(GET _g4dataset_tuple 2 Geant4_DATASET_$    226   list(GET _g4dataset_tuple 2 Geant4_DATASET_${_g4dataset_name}_PATH)
218 endforeach()                                      227 endforeach()
219 unset(Geant4_DATASET_DESCRIPTIONS)                228 unset(Geant4_DATASET_DESCRIPTIONS)
220                                                   229 
221 #---------------------------------------------    230 #-----------------------------------------------------------------------
222 # Optional Build Components                    << 231 # 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 #---------------------------------------------    232 #-----------------------------------------------------------------------
                                                   >> 233 # Many components are simply present as parts of libraries or always built
                                                   >> 234 # but require additional compile definitions.
                                                   >> 235 #
251 # Optionally import build-time package setting    236 # Optionally import build-time package settings to provide hard values
252 # for find_package to work with                   237 # for find_package to work with
253 include("${CMAKE_CURRENT_LIST_DIR}/Geant4Packa    238 include("${CMAKE_CURRENT_LIST_DIR}/Geant4PackageCache.cmake" OPTIONAL)
254                                                   239 
255 # - CLHEP                                      << 240 # Builtin/External packages
256 set(Geant4_system_clhep_FOUND @GEANT4_USE_SYST    241 set(Geant4_system_clhep_FOUND @GEANT4_USE_SYSTEM_CLHEP@)
                                                   >> 242 
257 if(Geant4_system_clhep_FOUND)                     243 if(Geant4_system_clhep_FOUND)
258   set(Geant4_builtin_clhep_FOUND FALSE)           244   set(Geant4_builtin_clhep_FOUND FALSE)
259   find_dependency(CLHEP @CLHEP_VERSION@ EXACT     245   find_dependency(CLHEP @CLHEP_VERSION@ EXACT CONFIG)
260 else()                                            246 else()
261   set(Geant4_builtin_clhep_FOUND TRUE)            247   set(Geant4_builtin_clhep_FOUND TRUE)
262 endif()                                           248 endif()
263                                                   249 
264 # - EXPAT                                      << 
265 set(Geant4_builtin_expat_FOUND @GEANT4_USE_BUI    250 set(Geant4_builtin_expat_FOUND @GEANT4_USE_BUILTIN_EXPAT@)
266 if(NOT Geant4_builtin_expat_FOUND)                251 if(NOT Geant4_builtin_expat_FOUND)
267   find_dependency(EXPAT @EXPAT_VERSION_STRING@    252   find_dependency(EXPAT @EXPAT_VERSION_STRING@)
268   include("${CMAKE_CURRENT_LIST_DIR}/G4EXPATSh    253   include("${CMAKE_CURRENT_LIST_DIR}/G4EXPATShim.cmake")
269 endif()                                           254 endif()
270                                                   255 
271 # - ZLIB                                       << 
272 set(Geant4_builtin_zlib_FOUND @GEANT4_USE_BUIL    256 set(Geant4_builtin_zlib_FOUND @GEANT4_USE_BUILTIN_ZLIB@)
273 if(NOT Geant4_builtin_zlib_FOUND)                 257 if(NOT Geant4_builtin_zlib_FOUND)
274   find_dependency(ZLIB @ZLIB_VERSION_STRING@)     258   find_dependency(ZLIB @ZLIB_VERSION_STRING@)
275 endif()                                           259 endif()
276                                                   260 
277 # - PTL/TBB                                    << 261 # PTL/TBB
                                                   >> 262 # - Refind of PTL will refind TBB
278 set(Geant4_system_ptl_FOUND @GEANT4_USE_SYSTEM    263 set(Geant4_system_ptl_FOUND @GEANT4_USE_SYSTEM_PTL@)
279 set(Geant4_TBB_FOUND @GEANT4_USE_TBB@)            264 set(Geant4_TBB_FOUND @GEANT4_USE_TBB@)
280 if(Geant4_system_ptl_FOUND)                       265 if(Geant4_system_ptl_FOUND)
281   set(Geant4_builtin_ptl_FOUND FALSE)             266   set(Geant4_builtin_ptl_FOUND FALSE)
282   if(Geant4_TBB_FOUND)                            267   if(Geant4_TBB_FOUND)
283     find_dependency(PTL @PTL_VERSION@ COMPONEN    268     find_dependency(PTL @PTL_VERSION@ COMPONENTS TBB)
284   else()                                          269   else()
285     find_dependency(PTL @PTL_VERSION@)            270     find_dependency(PTL @PTL_VERSION@)
286   endif()                                         271   endif()
287 else()                                            272 else()
288   # We know exactly where PTL is                  273   # We know exactly where PTL is
289   set(Geant4_builtin_ptl_FOUND TRUE)              274   set(Geant4_builtin_ptl_FOUND TRUE)
290   if(CMAKE_VERSION VERSION_GREATER 3.8.9999)      275   if(CMAKE_VERSION VERSION_GREATER 3.8.9999)
291     find_dependency(PTL NO_DEFAULT_PATH PATHS     276     find_dependency(PTL NO_DEFAULT_PATH PATHS "@PACKAGE_PTL_PREFIX@")
292   else()                                          277   else()
293     find_package(PTL REQUIRED NO_DEFAULT_PATH     278     find_package(PTL REQUIRED NO_DEFAULT_PATH PATHS "@PACKAGE_PTL_PREFIX@")
294   endif()                                         279   endif()
295 endif()                                           280 endif()
296                                                   281 
                                                   >> 282 # - Multithreading
                                                   >> 283 set(Geant4_multithreaded_FOUND @GEANT4_BUILD_MULTITHREADED@)
                                                   >> 284 if(Geant4_multithreaded_FOUND)
                                                   >> 285   # - Define variable to indicate TLS model used
                                                   >> 286   set(Geant4_TLS_MODEL "@GEANT4_BUILD_TLS_MODEL@")
                                                   >> 287   if(Geant4_TLS_MODEL STREQUAL "auto")
                                                   >> 288     unset(Geant4_TLS_MODEL)
                                                   >> 289   endif()
                                                   >> 290 endif()
                                                   >> 291 
297 # - GDML                                          292 # - GDML
298 set(Geant4_gdml_FOUND @GEANT4_USE_GDML@)          293 set(Geant4_gdml_FOUND @GEANT4_USE_GDML@)
299 if(Geant4_gdml_FOUND)                             294 if(Geant4_gdml_FOUND)
300   find_dependency(XercesC @XercesC_VERSION@)      295   find_dependency(XercesC @XercesC_VERSION@)
301 endif()                                           296 endif()
302                                                   297 
                                                   >> 298 # - Smart track stack
                                                   >> 299 set(Geant4_smartstack_FOUND @GEANT4_USE_SMARTSTACK@)
                                                   >> 300 
                                                   >> 301 # - ParticleHP as HP
                                                   >> 302 set(Geant4_php_as_hp_FOUND @GEANT4_BUILD_PHP_AS_HP@)
                                                   >> 303 
                                                   >> 304 # - TiMemory
                                                   >> 305 set(Geant4_timemory_FOUND @GEANT4_USE_TIMEMORY@)
                                                   >> 306 if(Geant4_timemory_FOUND)
                                                   >> 307   set(_geant4_use_timemory_library ON)
                                                   >> 308   set(timemory_DIR "@timemory_DIR@" CACHE PATH "timemory installation for Geant4")
                                                   >> 309   if(NOT TARGET @timemory_FIND_COMPONENTS_INTERFACE@)
                                                   >> 310     add_library(@timemory_FIND_COMPONENTS_INTERFACE@ INTERFACE IMPORTED)
                                                   >> 311     set(timemory_FIND_COMPONENTS_INTERFACE @timemory_FIND_COMPONENTS_INTERFACE@)
                                                   >> 312     find_package(timemory @G4timemory_VERSION@ REQUIRED QUIET
                                                   >> 313         COMPONENTS @G4timemory_COMPONENTS@)
                                                   >> 314   endif()
                                                   >> 315   set(timemory_LIBRARIES @timemory_FIND_COMPONENTS_INTERFACE@)
                                                   >> 316 endif()
                                                   >> 317 
                                                   >> 318 # - G3toG4
                                                   >> 319 set(Geant4_g3tog4_FOUND @GEANT4_USE_G3TOG4@)
                                                   >> 320 if(Geant4_g3tog4_FOUND)
                                                   >> 321   if(Geant4_FIND_REQUIRED_g3tog4)
                                                   >> 322     set(_geant4_use_g3tog4_library ON)
                                                   >> 323   endif()
                                                   >> 324 endif()
                                                   >> 325 
303 # - VecGeom                                       326 # - VecGeom
304 set(Geant4_usolids_FOUND @GEANT4_USE_USOLIDS_E    327 set(Geant4_usolids_FOUND @GEANT4_USE_USOLIDS_EITHER@)
305 if(Geant4_usolids_FOUND)                          328 if(Geant4_usolids_FOUND)
306   find_dependency(VecGeom @VecGeom_VERSION@)      329   find_dependency(VecGeom @VecGeom_VERSION@)
307 endif()                                           330 endif()
308                                                   331 
309 # - Freetype                                      332 # - Freetype
310 set(Geant4_freetype_FOUND @GEANT4_USE_FREETYPE    333 set(Geant4_freetype_FOUND @GEANT4_USE_FREETYPE@)
311 if(Geant4_freetype_FOUND)                         334 if(Geant4_freetype_FOUND)
312   find_dependency(Freetype @FREETYPE_VERSION_S    335   find_dependency(Freetype @FREETYPE_VERSION_STRING@)
313   include("${CMAKE_CURRENT_LIST_DIR}/G4Freetyp    336   include("${CMAKE_CURRENT_LIST_DIR}/G4FreetypeShim.cmake")
314 endif()                                           337 endif()
315                                                   338 
316 # - HDF5                                          339 # - HDF5
317 set(Geant4_hdf5_FOUND @GEANT4_USE_HDF5@)          340 set(Geant4_hdf5_FOUND @GEANT4_USE_HDF5@)
318 if(Geant4_hdf5_FOUND)                             341 if(Geant4_hdf5_FOUND)
319   find_dependency(HDF5)                        << 342   find_dependency(HDF5 @HDF5_VERSION@)
320   include("${CMAKE_CURRENT_LIST_DIR}/G4HDF5Shi    343   include("${CMAKE_CURRENT_LIST_DIR}/G4HDF5Shim.cmake")
321 endif()                                           344 endif()
322                                                   345 
323 #---------------------------------------------    346 #-----------------------------------------------------------------------
324 # UI/VIS                                          347 # UI/VIS
325 #                                                 348 #
326 # Prefer Legacy GL when using CMake >= 3.10       349 # Prefer Legacy GL when using CMake >= 3.10
327 set(OpenGL_GL_PREFERENCE_SAVE "${OpenGL_GL_PRE    350 set(OpenGL_GL_PREFERENCE_SAVE "${OpenGL_GL_PREFERENCE}")
328 set(OpenGL_GL_PREFERENCE "LEGACY")                351 set(OpenGL_GL_PREFERENCE "LEGACY")
329                                                   352 
330 # - Helper variables for ui/vis_all components    353 # - Helper variables for ui/vis_all components
331 if("ui_all" IN_LIST Geant4_FIND_COMPONENTS)       354 if("ui_all" IN_LIST Geant4_FIND_COMPONENTS)
332   set(Geant4_ui_all_FOUND TRUE)                   355   set(Geant4_ui_all_FOUND TRUE)
333 endif()                                           356 endif()
334                                                   357 
335 if("vis_all" IN_LIST Geant4_FIND_COMPONENTS)      358 if("vis_all" IN_LIST Geant4_FIND_COMPONENTS)
336   set(Geant4_vis_all_FOUND TRUE)                  359   set(Geant4_vis_all_FOUND TRUE)
337 endif()                                           360 endif()
338                                                   361 
339 # - UI : TCSH                                     362 # - UI : TCSH
340 set(Geant4_ui_tcsh_FOUND @UNIX@)                  363 set(Geant4_ui_tcsh_FOUND @UNIX@)
341                                                   364 
342 # - UI : win32                                    365 # - UI : win32
343 set(Geant4_ui_win32_FOUND @WIN32@)                366 set(Geant4_ui_win32_FOUND @WIN32@)
344                                                   367 
345 #---------------------------------------------    368 #-----------------------------------------------------------------------
346 # Components which requires slightly more comp    369 # Components which requires slightly more complex setup
347 #                                                 370 #
348 # - Visualization : RayTracerX                    371 # - Visualization : RayTracerX
349 set(Geant4_vis_raytracer_x11_FOUND @GEANT4_USE    372 set(Geant4_vis_raytracer_x11_FOUND @GEANT4_USE_RAYTRACER_X11@)
350 if(Geant4_vis_raytracer_x11_FOUND)                373 if(Geant4_vis_raytracer_x11_FOUND)
351   find_dependency(X11)                            374   find_dependency(X11)
352   include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim    375   include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
353 endif()                                           376 endif()
354                                                   377 
355 # - Qt (UI and Vis!)                              378 # - Qt (UI and Vis!)
356 set(Geant4_qt_FOUND @GEANT4_USE_QT@)              379 set(Geant4_qt_FOUND @GEANT4_USE_QT@)
357 set(Geant4_qt3d_FOUND @GEANT4_USE_QT3D@)          380 set(Geant4_qt3d_FOUND @GEANT4_USE_QT3D@)
358 if(Geant4_qt_FOUND)                               381 if(Geant4_qt_FOUND)
359   # Must always refind Qt to recreate imported    382   # Must always refind Qt to recreate imported targets. Because these
360   # are in the public interface, always need l    383   # are in the public interface, always need linking.
361   find_dependency(Qt@QT_VERSION_MAJOR@Core REQ    384   find_dependency(Qt@QT_VERSION_MAJOR@Core REQUIRED)
362   find_dependency(Qt@QT_VERSION_MAJOR@Gui REQU    385   find_dependency(Qt@QT_VERSION_MAJOR@Gui REQUIRED)
363   find_dependency(Qt@QT_VERSION_MAJOR@Widgets     386   find_dependency(Qt@QT_VERSION_MAJOR@Widgets REQUIRED)
364   find_dependency(Qt@QT_VERSION_MAJOR@OpenGL R    387   find_dependency(Qt@QT_VERSION_MAJOR@OpenGL REQUIRED)
365   if(@QT_VERSION_MAJOR@ GREATER 5)                388   if(@QT_VERSION_MAJOR@ GREATER 5)
366     find_dependency(Qt@QT_VERSION_MAJOR@OpenGL    389     find_dependency(Qt@QT_VERSION_MAJOR@OpenGLWidgets REQUIRED)
367   endif()                                         390   endif()
368                                                   391 
369   if(Geant4_qt3d_FOUND)                           392   if(Geant4_qt3d_FOUND)
370     find_dependency(Qt@QT_VERSION_MAJOR@3DCore    393     find_dependency(Qt@QT_VERSION_MAJOR@3DCore @QT3D_MINIMUM_VERSION@ REQUIRED)
371     find_dependency(Qt@QT_VERSION_MAJOR@3DExtr    394     find_dependency(Qt@QT_VERSION_MAJOR@3DExtras @QT3D_MINIMUM_VERSION@ REQUIRED)
372     find_dependency(Qt@QT_VERSION_MAJOR@3DRend    395     find_dependency(Qt@QT_VERSION_MAJOR@3DRender @QT3D_MINIMUM_VERSION@ REQUIRED)
373   endif()                                         396   endif()
374                                                   397 
375   # Also require OpenGL                           398   # Also require OpenGL
376   find_dependency(OpenGL)                         399   find_dependency(OpenGL)
377                                                   400 
378   # Qt must be activated both directly and for    401   # Qt must be activated both directly and for OpenInventor
379   if(("qt" IN_LIST Geant4_FIND_COMPONENTS)        402   if(("qt" IN_LIST Geant4_FIND_COMPONENTS)
380      OR ("vis_openinventor" IN_LIST Geant4_FIN    403      OR ("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS)
                                                   >> 404      OR ("vis_toolssg_qt_gles" IN_LIST Geant4_FIND_COMPONENTS)
381      OR Geant4_ui_all_FOUND OR Geant4_vis_all_    405      OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
382     set(_geant4_use_opengl_library ON)            406     set(_geant4_use_opengl_library ON)
383     # Qt3D is always on if available              407     # Qt3D is always on if available
384     set(_geant4_use_qt3D_library ${Geant4_qt3d    408     set(_geant4_use_qt3D_library ${Geant4_qt3d_FOUND})
385   endif()                                         409   endif()
386 endif()                                           410 endif()
387                                                   411 
388 # - Motif (UI and Vis!)                           412 # - Motif (UI and Vis!)
389 set(Geant4_motif_FOUND @GEANT4_USE_XM@)           413 set(Geant4_motif_FOUND @GEANT4_USE_XM@)
390 if(Geant4_motif_FOUND)                            414 if(Geant4_motif_FOUND)
391   find_dependency(X11)                            415   find_dependency(X11)
392   include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim    416   include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
393   find_dependency(Motif)                          417   find_dependency(Motif)
394   include("${CMAKE_CURRENT_LIST_DIR}/G4MotifSh    418   include("${CMAKE_CURRENT_LIST_DIR}/G4MotifShim.cmake")
395   if(APPLE)                                       419   if(APPLE)
396     find_dependency(XQuartzGL)                    420     find_dependency(XQuartzGL)
397   else()                                          421   else()
398     find_dependency(OpenGL)                       422     find_dependency(OpenGL)
399   endif()                                         423   endif()
400                                                   424 
401   # Motif can be activated both directly and f    425   # Motif can be activated both directly and for OpenInventor
402   if(("motif" IN_LIST Geant4_FIND_COMPONENTS)     426   if(("motif" IN_LIST Geant4_FIND_COMPONENTS)
403      OR ("vis_openinventor" IN_LIST Geant4_FIN    427      OR ("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS)
                                                   >> 428      OR ("vis_toolssg_xt_gles" IN_LIST Geant4_FIND_COMPONENTS)
404      OR Geant4_ui_all_FOUND OR Geant4_vis_all_    429      OR Geant4_ui_all_FOUND OR Geant4_vis_all_FOUND)
405     set(_geant4_use_opengl_library ON)            430     set(_geant4_use_opengl_library ON)
406   endif()                                         431   endif()
407 endif()                                           432 endif()
408                                                   433 
409 # - OpenGL X11                                    434 # - OpenGL X11
410 set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OP    435 set(Geant4_vis_opengl_x11_FOUND @GEANT4_USE_OPENGL_X11@)
411 if(Geant4_vis_opengl_x11_FOUND)                   436 if(Geant4_vis_opengl_x11_FOUND)
412   find_dependency(X11)                            437   find_dependency(X11)
413   include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim    438   include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
414   if(APPLE)                                       439   if(APPLE)
415     find_dependency(XQuartzGL)                    440     find_dependency(XQuartzGL)
416   else()                                          441   else()
417     find_dependency(OpenGL)                       442     find_dependency(OpenGL)
418   endif()                                         443   endif()
419                                                   444 
420   if(("vis_opengl_x11" IN_LIST Geant4_FIND_COM    445   if(("vis_opengl_x11" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
421     set(_geant4_use_opengl_library ON)            446     set(_geant4_use_opengl_library ON)
422   endif()                                         447   endif()
423 endif()                                           448 endif()
424                                                   449 
425 # - OpenGL Win32                                  450 # - OpenGL Win32
426 set(Geant4_vis_opengl_win32_FOUND @GEANT4_USE_    451 set(Geant4_vis_opengl_win32_FOUND @GEANT4_USE_OPENGL_WIN32@)
427 if(Geant4_vis_opengl_win32_FOUND)                 452 if(Geant4_vis_opengl_win32_FOUND)
428   find_dependency(OpenGL)                         453   find_dependency(OpenGL)
429   if(("vis_opengl_win32" IN_LIST Geant4_FIND_C    454   if(("vis_opengl_win32" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
430     set(_geant4_use_opengl_library ON)            455     set(_geant4_use_opengl_library ON)
431   endif()                                         456   endif()
432 endif()                                           457 endif()
433                                                   458 
434 # - OpenInventor                                  459 # - OpenInventor
435 set(Geant4_vis_openinventor_FOUND @GEANT4_USE_    460 set(Geant4_vis_openinventor_FOUND @GEANT4_USE_INVENTOR@)
436 set(Geant4_vis_openinventor_qt_FOUND @GEANT4_U    461 set(Geant4_vis_openinventor_qt_FOUND @GEANT4_USE_INVENTOR_QT@)
437 if(Geant4_vis_openinventor_FOUND)                 462 if(Geant4_vis_openinventor_FOUND)
438   find_dependency(Coin)                           463   find_dependency(Coin)
439                                                   464 
440   if(Geant4_vis_openinventor_qt_FOUND)            465   if(Geant4_vis_openinventor_qt_FOUND)
441     # Qt dependency handled by Geant4_vis_qt_F    466     # Qt dependency handled by Geant4_vis_qt_FOUND earlier,
442     # always ON if Inventor_QT is                 467     # always ON if Inventor_QT is
443     find_dependency(SoQt)                         468     find_dependency(SoQt)
444   else()                                          469   else()
445     if(WIN32)                                     470     if(WIN32)
446       find_dependency(SoWin)                      471       find_dependency(SoWin)
447     else()                                        472     else()
448       # Motif/X11/GL dependency handled by Gea    473       # Motif/X11/GL dependency handled by Geant4_motif_FOUND earlier,
449       # always ON if Inventor/Xt is.              474       # always ON if Inventor/Xt is.
450       find_dependency(SoXt)                       475       find_dependency(SoXt)
451     endif()                                       476     endif()
452   endif()                                         477   endif()
453                                                   478 
454   if(("vis_openinventor" IN_LIST Geant4_FIND_C    479   if(("vis_openinventor" IN_LIST Geant4_FIND_COMPONENTS) OR Geant4_vis_all_FOUND)
455     set(_geant4_use_inventor_library ON)          480     set(_geant4_use_inventor_library ON)
456   endif()                                         481   endif()
457 endif()                                           482 endif()
458                                                   483 
                                                   >> 484 # - ToolsSG X11/GLES
                                                   >> 485 set(Geant4_vis_toolssg_x11_gles_FOUND @GEANT4_USE_TOOLSSG_X11_GLES@)
                                                   >> 486 if(Geant4_vis_toolssg_x11_gles_FOUND)
                                                   >> 487   find_dependency(X11)
                                                   >> 488   include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
                                                   >> 489   if(APPLE)
                                                   >> 490     find_dependency(XQuartzGL)
                                                   >> 491   else()
                                                   >> 492     find_dependency(OpenGL)
                                                   >> 493   endif()
                                                   >> 494 endif()
                                                   >> 495 
                                                   >> 496 # - ToolsSG X11/ZB
                                                   >> 497 set(Geant4_vis_toolssg_x11_zb_FOUND @GEANT4_USE_TOOLSSG_X11_ZB@)
                                                   >> 498 if(Geant4_vis_toolssg_x11_zb_FOUND)
                                                   >> 499   find_dependency(X11)
                                                   >> 500   include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
                                                   >> 501 endif()
                                                   >> 502 
                                                   >> 503 # - ToolsSG Windows/GLES
                                                   >> 504 set(Geant4_vis_toolssg_windows_gles_FOUND @GEANT4_USE_TOOLSSG_WINDOWS_GLES@)
                                                   >> 505 if(Geant4_vis_toolssg_windows_gles_FOUND)
                                                   >> 506   find_dependency(OpenGL)
                                                   >> 507 endif()
                                                   >> 508 
                                                   >> 509 # - ToolsSG Windows/ZB
                                                   >> 510 set(Geant4_vis_toolssg_windows_zb_FOUND @GEANT4_USE_TOOLSSG_WINDOWS_ZB@)
                                                   >> 511 
                                                   >> 512 # - ToolsSG Xt/GLES
                                                   >> 513 set(Geant4_vis_toolssg_xt_gles_FOUND @GEANT4_USE_TOOLSSG_XT_GLES@)
                                                   >> 514 if(Geant4_vis_toolssg_xt_gles_FOUND)
                                                   >> 515   find_dependency(X11)
                                                   >> 516   include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
                                                   >> 517   if(APPLE)
                                                   >> 518     find_dependency(XQuartzGL)
                                                   >> 519   else()
                                                   >> 520     find_dependency(OpenGL)
                                                   >> 521   endif()
                                                   >> 522 endif()
                                                   >> 523 
                                                   >> 524 # - ToolsSG Xt/ZB
                                                   >> 525 set(Geant4_vis_toolssg_xt_zb_FOUND @GEANT4_USE_TOOLSSG_XT_ZB@)
                                                   >> 526 if(Geant4_vis_toolssg_xt_zb_FOUND)
                                                   >> 527   find_dependency(X11)
                                                   >> 528   include("${CMAKE_CURRENT_LIST_DIR}/G4X11Shim.cmake")
                                                   >> 529 endif()
                                                   >> 530 
                                                   >> 531 # - ToolsSG Qt/GLES
                                                   >> 532 set(Geant4_vis_toolssg_qt_gles_FOUND @GEANT4_USE_TOOLSSG_QT_GLES@)
                                                   >> 533 if(Geant4_vis_toolssg_qt_gles_FOUND)
                                                   >> 534   find_dependency(OpenGL)
                                                   >> 535 endif()
                                                   >> 536 
                                                   >> 537 # - ToolsSG Qt/ZB
                                                   >> 538 set(Geant4_vis_toolssg_qt_zb_FOUND @GEANT4_USE_TOOLSSG_QT_ZB@)
                                                   >> 539 
459 # Reset any OpenGL Preference                     540 # Reset any OpenGL Preference
460 set(OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFEREN    541 set(OpenGL_GL_PREFERENCE "${OpenGL_GL_PREFERENCE_SAVE}")
461                                                   542 
462 set(Geant4_vis_Vtk_FOUND @GEANT4_USE_VTK@)        543 set(Geant4_vis_Vtk_FOUND @GEANT4_USE_VTK@)
463 if(Geant4_vis_Vtk_FOUND)                          544 if(Geant4_vis_Vtk_FOUND)
464   find_dependency(VTK 9 REQUIRED COMPONENTS       545   find_dependency(VTK 9 REQUIRED COMPONENTS
465     CommonColor                                   546     CommonColor
466     InteractionStyle                              547     InteractionStyle
467     IOExport                                      548     IOExport
468     GUISupportQt                                  549     GUISupportQt
469     RenderingVolumeOpenGL2                        550     RenderingVolumeOpenGL2
470   )                                               551   )
471   set(_geant4_use_vtk_library ON)                 552   set(_geant4_use_vtk_library ON)
472 endif()                                           553 endif()
473                                                   554 
474 #---------------------------------------------    555 #-----------------------------------------------------------------------
475 # Include the files listing all the imported t    556 # Include the files listing all the imported targets and configuring
476 # Intel/MSVC Compile Features                     557 # Intel/MSVC Compile Features
477 # (Not needed if used in the same Geant4 proje    558 # (Not needed if used in the same Geant4 project, or if we have run before)
478 # This is always installed in the same locatio    559 # This is always installed in the same location as us...
479 #                                                 560 #
480 if(NOT CMAKE_PROJECT_NAME STREQUAL Geant4)        561 if(NOT CMAKE_PROJECT_NAME STREQUAL Geant4)
481   include("${_geant4_thisdir}/Modules/IntelCom    562   include("${_geant4_thisdir}/Modules/IntelCompileFeatures.cmake")
482   include("${_geant4_thisdir}/Modules/MSVCComp    563   include("${_geant4_thisdir}/Modules/MSVCCompileFeatures.cmake")
483                                                   564 
484   if(NOT Geant4_LIBDEPS_LOADED)                   565   if(NOT Geant4_LIBDEPS_LOADED)
485     include("${_geant4_thisdir}/Geant4LibraryD    566     include("${_geant4_thisdir}/Geant4LibraryDepends.cmake")
486     set(Geant4_LIBDEPS_LOADED 1)                  567     set(Geant4_LIBDEPS_LOADED 1)
487   endif()                                         568   endif()
488 endif()                                           569 endif()
489                                                   570 
490 #---------------------------------------------    571 #-----------------------------------------------------------------------
491 # Now perform final configuration of libraries    572 # Now perform final configuration of libraries...
492 # We provide FOUND variables for presence of s    573 # We provide FOUND variables for presence of shared and static
493 # User can supply "static" component to force     574 # User can supply "static" component to force use of static libraries, if
494 # available.                                      575 # available.
495 set(Geant4_shared_FOUND @BUILD_SHARED_LIBS@)      576 set(Geant4_shared_FOUND @BUILD_SHARED_LIBS@)
496 set(Geant4_static_FOUND @BUILD_STATIC_LIBS@)      577 set(Geant4_static_FOUND @BUILD_STATIC_LIBS@)
497                                                   578 
498 # - Default setting : shared if available, sta    579 # - Default setting : shared if available, static otherwise
499 if(Geant4_shared_FOUND)                           580 if(Geant4_shared_FOUND)
500   set(_geant4_lib_use_suffix "")                  581   set(_geant4_lib_use_suffix "")
501 else()                                            582 else()
502   set(_geant4_lib_use_suffix "-static")           583   set(_geant4_lib_use_suffix "-static")
503 endif()                                           584 endif()
504                                                   585 
505 if(("static" IN_LIST Geant4_FIND_COMPONENTS) A    586 if(("static" IN_LIST Geant4_FIND_COMPONENTS) AND Geant4_static_FOUND)
506   set(_geant4_lib_use_suffix "-static")           587   set(_geant4_lib_use_suffix "-static")
507 endif()                                           588 endif()
508                                                   589 
509 # The list of libraries probably should be aut    590 # The list of libraries probably should be autogenerated, but we hard code
510 # for now. We don't have to divide the list of    591 # 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    592 # do so for consistency with the way we'll need to do it for static.
512 # - Always on Vis Components                      593 # - Always on Vis Components
513 set(_geant4_internal_libraries                    594 set(_geant4_internal_libraries
514   Geant4::G4Tree${_geant4_lib_use_suffix}         595   Geant4::G4Tree${_geant4_lib_use_suffix}
515   Geant4::G4FR${_geant4_lib_use_suffix}           596   Geant4::G4FR${_geant4_lib_use_suffix}
516   Geant4::G4GMocren${_geant4_lib_use_suffix}      597   Geant4::G4GMocren${_geant4_lib_use_suffix}
517   Geant4::G4visHepRep${_geant4_lib_use_suffix}    598   Geant4::G4visHepRep${_geant4_lib_use_suffix}
518   Geant4::G4RayTracer${_geant4_lib_use_suffix}    599   Geant4::G4RayTracer${_geant4_lib_use_suffix}
519   Geant4::G4VRML${_geant4_lib_use_suffix}         600   Geant4::G4VRML${_geant4_lib_use_suffix}
520   Geant4::G4ToolsSG${_geant4_lib_use_suffix})     601   Geant4::G4ToolsSG${_geant4_lib_use_suffix})
521                                                   602 
522 # - G4OpenGL if it's requested.                   603 # - G4OpenGL if it's requested.
523 if(_geant4_use_opengl_library)                    604 if(_geant4_use_opengl_library)
524   list(APPEND _geant4_internal_libraries Geant    605   list(APPEND _geant4_internal_libraries Geant4::G4OpenGL${_geant4_lib_use_suffix})
525 endif()                                           606 endif()
526                                                   607 
527 # - Qt3D if it's requested.                       608 # - Qt3D if it's requested.
528 if(_geant4_use_qt3D_library)                      609 if(_geant4_use_qt3D_library)
529   list(APPEND _geant4_internal_libraries Geant    610   list(APPEND _geant4_internal_libraries Geant4::G4visQt3D${_geant4_lib_use_suffix})
530 endif()                                           611 endif()
531                                                   612 
532 # - G4OpenInventor if it's requested.             613 # - G4OpenInventor if it's requested.
533 if(_geant4_use_inventor_library)                  614 if(_geant4_use_inventor_library)
534   list(APPEND _geant4_internal_libraries Geant    615   list(APPEND _geant4_internal_libraries Geant4::G4OpenInventor${_geant4_lib_use_suffix})
535 endif()                                           616 endif()
536                                                   617 
537 if(_geant4_use_vtk_library)                       618 if(_geant4_use_vtk_library)
538   list(APPEND _geant4_internal_libraries Geant    619   list(APPEND _geant4_internal_libraries Geant4::G4visVtk${_geant4_lib_use_suffix})
539 endif()                                           620 endif()
540                                                   621 
541 # - GDML always added for now as old G4persist    622 # - GDML always added for now as old G4persistency lib always added if present
542 if(Geant4_gdml_FOUND)                             623 if(Geant4_gdml_FOUND)
543   set(_geant4_g4gdml_library Geant4::G4gdml${_    624   set(_geant4_g4gdml_library Geant4::G4gdml${_geant4_lib_use_suffix})
544 endif()                                           625 endif()
545                                                   626 
546 # - G3toG4 if it's requested                      627 # - G3toG4 if it's requested
547 if(_geant4_use_g3tog4_library)                    628 if(_geant4_use_g3tog4_library)
548   set(_geant4_g3tog4_library Geant4::G3toG4${_    629   set(_geant4_g3tog4_library Geant4::G3toG4${_geant4_lib_use_suffix})
549 endif()                                           630 endif()
550                                                   631 
                                                   >> 632 # - link to timemory library if activated
                                                   >> 633 if(_geant4_use_timemory_library)
                                                   >> 634   list(APPEND _geant4_internal_libraries ${timemory_LIBRARIES})
                                                   >> 635 endif()
                                                   >> 636 
                                                   >> 637 # - Factory registration mechanism in physics_lists requires whole
                                                   >> 638 # archive to be linked when using static libs, so requires wrapping
                                                   >> 639 # with suitable compiler dependent flags
                                                   >> 640 # 2016-05-24: use an alternate means of forcing linking of references for
                                                   >> 641 # static builds.  --whole-archive never was implemented for _WIN32
                                                   >> 642 # (appears not to even be possible)
                                                   >> 643 # In order re-implement whole-archive, switch Geant4_FORCE_WHOLE_ARCHIVE ON
551 set(_geant4_physicslists_library Geant4::G4phy    644 set(_geant4_physicslists_library Geant4::G4physicslists${_geant4_lib_use_suffix})
                                                   >> 645 
                                                   >> 646 set(Geant4_FORCE_WHOLE_ARCHIVE OFF)
                                                   >> 647 if( Geant4_FORCE_WHOLE_ARCHIVE )
                                                   >> 648 if(_geant4_lib_use_suffix STREQUAL "-static")
                                                   >> 649   # - Use CMAKE_CXX_COMPILER_ID, which should be reliable enough...
                                                   >> 650   # Though the GNU/Clang/Intel compilers/linkers *should* use identical
                                                   >> 651   # flags,keep their sections separate until behaviour confirmed
                                                   >> 652   #
                                                   >> 653   if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
                                                   >> 654     set(_geant4_physicslists_library -Wl,--whole-archive Geant4::G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive)
                                                   >> 655   elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
                                                   >> 656     set(_geant4_physicslists_library -Wl,-force_load Geant4::G4physicslists${_geant4_lib_use_suffix})
                                                   >> 657   elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
                                                   >> 658     set(_geant4_physicslists_library -Wl,--whole-archive Geant4::G4physicslists${_geant4_lib_use_suffix} -Wl,--no-whole-archive)
                                                   >> 659   else()
                                                   >> 660     # Needs determination of other compiler options.
                                                   >> 661     # NB: MSVC has /OPT:NOREF, but may apply globally...
                                                   >> 662     # reading up on this ... doesn't seem that it applies for subtle reasons
                                                   >> 663     # only real way is to actually reference the static variables
                                                   >> 664     set(_geant4_physicslists_library Geant4::G4physicslists${_geant4_lib_use_suffix})
                                                   >> 665   endif()
                                                   >> 666 endif()
                                                   >> 667 endif()
552                                                   668 
553 # - 'Kernel' libraries                            669 # - 'Kernel' libraries
554 list(APPEND _geant4_internal_libraries            670 list(APPEND _geant4_internal_libraries
555   Geant4::G4vis_management${_geant4_lib_use_su    671   Geant4::G4vis_management${_geant4_lib_use_suffix}
556   Geant4::G4modeling${_geant4_lib_use_suffix}     672   Geant4::G4modeling${_geant4_lib_use_suffix}
557   Geant4::G4interfaces${_geant4_lib_use_suffix    673   Geant4::G4interfaces${_geant4_lib_use_suffix}
558   Geant4::G4mctruth${_geant4_lib_use_suffix}      674   Geant4::G4mctruth${_geant4_lib_use_suffix}
559   Geant4::G4geomtext${_geant4_lib_use_suffix}     675   Geant4::G4geomtext${_geant4_lib_use_suffix}
560   ${_geant4_g4gdml_library}                       676   ${_geant4_g4gdml_library}
561   ${_geant4_g3tog4_library}                       677   ${_geant4_g3tog4_library}
562   Geant4::G4analysis${_geant4_lib_use_suffix}     678   Geant4::G4analysis${_geant4_lib_use_suffix}
563   Geant4::G4error_propagation${_geant4_lib_use    679   Geant4::G4error_propagation${_geant4_lib_use_suffix}
564   Geant4::G4readout${_geant4_lib_use_suffix}      680   Geant4::G4readout${_geant4_lib_use_suffix}
565   ${_geant4_physicslists_library}                 681   ${_geant4_physicslists_library}
566   Geant4::G4run${_geant4_lib_use_suffix}          682   Geant4::G4run${_geant4_lib_use_suffix}
567   Geant4::G4event${_geant4_lib_use_suffix}        683   Geant4::G4event${_geant4_lib_use_suffix}
568   Geant4::G4tracking${_geant4_lib_use_suffix}     684   Geant4::G4tracking${_geant4_lib_use_suffix}
569   Geant4::G4parmodels${_geant4_lib_use_suffix}    685   Geant4::G4parmodels${_geant4_lib_use_suffix}
570   Geant4::G4processes${_geant4_lib_use_suffix}    686   Geant4::G4processes${_geant4_lib_use_suffix}
571   Geant4::G4digits_hits${_geant4_lib_use_suffi    687   Geant4::G4digits_hits${_geant4_lib_use_suffix}
572   Geant4::G4track${_geant4_lib_use_suffix}        688   Geant4::G4track${_geant4_lib_use_suffix}
573   Geant4::G4particles${_geant4_lib_use_suffix}    689   Geant4::G4particles${_geant4_lib_use_suffix}
574   Geant4::G4geometry${_geant4_lib_use_suffix}     690   Geant4::G4geometry${_geant4_lib_use_suffix}
575   Geant4::G4materials${_geant4_lib_use_suffix}    691   Geant4::G4materials${_geant4_lib_use_suffix}
576   Geant4::G4graphics_reps${_geant4_lib_use_suf    692   Geant4::G4graphics_reps${_geant4_lib_use_suffix}
577   Geant4::G4intercoms${_geant4_lib_use_suffix}    693   Geant4::G4intercoms${_geant4_lib_use_suffix}
578   Geant4::G4global${_geant4_lib_use_suffix}       694   Geant4::G4global${_geant4_lib_use_suffix}
579   # G4tools is INTERFACE, so same for both sta    695   # G4tools is INTERFACE, so same for both static/shared.
580   Geant4::G4tools                                 696   Geant4::G4tools
581   )                                               697   )
582                                                   698 
583 # - Any externals built by Geant4                 699 # - Any externals built by Geant4
584 foreach(_extlib @GEANT4_EXTERNALS_TARGETS@)       700 foreach(_extlib @GEANT4_EXTERNALS_TARGETS@)
585   list(APPEND                                     701   list(APPEND
586     _geant4_internal_libraries                    702     _geant4_internal_libraries
587     Geant4::${_extlib}${_geant4_lib_use_suffix    703     Geant4::${_extlib}${_geant4_lib_use_suffix}
588     )                                             704     )
589 endforeach()                                      705 endforeach()
590                                                   706 
591 # - Now set them to Geant4_LIBRARIES              707 # - Now set them to Geant4_LIBRARIES
592 set(Geant4_LIBRARIES ${_geant4_internal_librar    708 set(Geant4_LIBRARIES ${_geant4_internal_libraries})
593                                                   709 
594 #---------------------------------------------    710 #-----------------------------------------------------------------------
595 # Remove any duplicates from the Geant4_{INCLU    711 # Remove any duplicates from the Geant4_{INCLUDE_DIRS,LIBRARIES}
596 # variables so that multiple passes append thi    712 # variables so that multiple passes append things correctly
597 #                                                 713 #
598 if(Geant4_INCLUDE_DIRS)                           714 if(Geant4_INCLUDE_DIRS)
599   list(REMOVE_DUPLICATES Geant4_INCLUDE_DIRS)     715   list(REMOVE_DUPLICATES Geant4_INCLUDE_DIRS)
600 endif()                                           716 endif()
601                                                   717 
602 if(Geant4_LIBRARIES)                              718 if(Geant4_LIBRARIES)
603   list(REMOVE_DUPLICATES Geant4_LIBRARIES)        719   list(REMOVE_DUPLICATES Geant4_LIBRARIES)
604 endif()                                           720 endif()
605                                                   721 
606 #---------------------------------------------    722 #-----------------------------------------------------------------------
607 # Point the user to the UseGeant4.cmake file w    723 # Point the user to the UseGeant4.cmake file which they may wish to include
608 # to help them with setting up Geant4             724 # to help them with setting up Geant4
609 #                                                 725 #
610 set(Geant4_USE_FILE "${_geant4_thisdir}/UseGea    726 set(Geant4_USE_FILE "${_geant4_thisdir}/UseGeant4.cmake")
611                                                   727 
612 #---------------------------------------------    728 #-----------------------------------------------------------------------
613 # Pop our custom module path from the CMake on    729 # Pop our custom module path from the CMake one
614 list(REMOVE_AT CMAKE_MODULE_PATH 0)               730 list(REMOVE_AT CMAKE_MODULE_PATH 0)
615                                                   731 
616 #---------------------------------------------    732 #-----------------------------------------------------------------------
617 # Check FOUNDness of required components.         733 # Check FOUNDness of required components.
618 foreach(_comp ${Geant4_FIND_COMPONENTS})          734 foreach(_comp ${Geant4_FIND_COMPONENTS})
619   if(NOT Geant4_${_comp}_FOUND)                   735   if(NOT Geant4_${_comp}_FOUND)
620     if(Geant4_FIND_REQUIRED_${_comp})             736     if(Geant4_FIND_REQUIRED_${_comp})
621       message(WARNING "Geant4 required compone    737       message(WARNING "Geant4 required component '${_comp}' not found")
622       set(Geant4_FOUND FALSE)                     738       set(Geant4_FOUND FALSE)
623     endif()                                       739     endif()
624   endif()                                         740   endif()
625 endforeach()                                      741 endforeach()
626                                                   742 
627 #---------------------------------------------    743 #-----------------------------------------------------------------------
628 # Reporting via FindPackageHandleStandardArgs     744 # Reporting via FindPackageHandleStandardArgs "CONFIG_MODE" to give a better message on being found
629 include(FindPackageHandleStandardArgs)            745 include(FindPackageHandleStandardArgs)
630 set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE    746 set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
631 find_package_handle_standard_args(@PROJECT_NAM    747 find_package_handle_standard_args(@PROJECT_NAME@ CONFIG_MODE)