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 10.7.p4)


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