Geant4 Cross Reference |
1 # - Use file for Geant4 1 # - Use file for Geant4 2 # Add Module directory so that examples can us << 2 # This file should be included after a find_package call has successfully 3 # modules. Appended to minimize any conflict w << 3 # located Geant4. If Geant4 has been located via the Geant4Config.cmake 4 # settings << 4 # config file, this will have set the following variable: 5 # DEPRECATED: Only needed by certain examples << 5 # 6 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_ << 6 # Geant4_USE_FILE : Point to the location of the use file for the found >> 7 # Geant4 installation. >> 8 # >> 9 # Inclusion of this file, e.g. via >> 10 # >> 11 # include(${Geant4_USE_FILE}) >> 12 # >> 13 # results in the addition of the Geant4 compile definitions and >> 14 # include directories to those of the directory in which this file is >> 15 # included. >> 16 # >> 17 # Header paths are added to include_directories as SYSTEM type directories >> 18 # >> 19 # The recommended Geant4 compiler flags are also prepended to >> 20 # CMAKE_CXX_FLAGS but duplicated flags are NOT removed. This permits >> 21 # client of UseGeant4 to override Geant4's recommended flags if required >> 22 # and at their own risk. >> 23 # >> 24 # Advanced users requiring special sets of flags, or the removal of >> 25 # duplicate flags should therefore *not* use this file, preferring the >> 26 # direct use of the Geant4_XXXX variables set by the Geant4Config file. >> 27 # >> 28 # The last thing the module does is to optionally include an internal Use >> 29 # file. This file can contain variables, functions and macros for strict >> 30 # internal use in Geant4, such as building and running validation tests. >> 31 # >> 32 >> 33 #----------------------------------------------------------------------- >> 34 # We need to set the compile definitions and include directories >> 35 # >> 36 add_definitions(${Geant4_DEFINITIONS}) >> 37 include_directories(AFTER SYSTEM ${Geant4_INCLUDE_DIRS}) >> 38 >> 39 #----------------------------------------------------------------------- >> 40 # Because Geant4 is sensitive to the compiler flags, set the base >> 41 # set here. This reproduces as far as possible the behaviour of the >> 42 # original makefile system. Users requiring additional flags must append them >> 43 # *after* inclusion of this file >> 44 # >> 45 set(CMAKE_CXX_FLAGS "${Geant4_CXX_FLAGS}") >> 46 set(CMAKE_CXX_FLAGS_DEBUG "${Geant4_CXX_FLAGS_DEBUG}") >> 47 set(CMAKE_CXX_FLAGS_MINSIZEREL "${Geant4_CXX_FLAGS_MINSIZEREL}") >> 48 set(CMAKE_CXX_FLAGS_RELEASE "${Geant4_CXX_FLAGS_RELEASE}") >> 49 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${Geant4_CXX_FLAGS_RELWITHDEBINFO}") >> 50 set(CMAKE_EXE_LINKER_FLAGS "${Geant4_EXE_LINKER_FLAGS}") >> 51 >> 52 #----------------------------------------------------------------------- >> 53 # Update build type information ONLY for single mode build tools, adding >> 54 # type used to build this install if none has been set, but otherwise leaving >> 55 # value alone. >> 56 # NB: this doesn't allow "None" for the build type - would need something >> 57 # more sophisticated using an internal cache variable. >> 58 # Good enough for now! >> 59 # >> 60 if(NOT CMAKE_CONFIGURATION_TYPES) >> 61 if(NOT CMAKE_BUILD_TYPE) >> 62 # Default to type used to build this install. >> 63 set(CMAKE_BUILD_TYPE "${Geant4_BUILD_TYPE}" >> 64 CACHE STRING "Choose the type of build, options are: None Release MinSizeRel Debug RelWithDebInfo MinSizeRel." >> 65 FORCE >> 66 ) >> 67 else() >> 68 # Force to the cache, but use existing value. >> 69 set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" >> 70 CACHE STRING "Choose the type of build, options are: None Release MinSizeRel Debug RelWithDebInfo MinSizeRel." >> 71 FORCE >> 72 ) >> 73 endif() >> 74 endif() >> 75 >> 76 #----------------------------------------------------------------------- >> 77 # Locate ourselves >> 78 # >> 79 get_filename_component(_use_geant4_dir ${CMAKE_CURRENT_LIST_FILE} PATH) >> 80 >> 81 #----------------------------------------------------------------------- >> 82 # Append the local module path to CMAKE_MODULE_PATH to automatically >> 83 # make FindXXX modules for examples available >> 84 # >> 85 list(APPEND CMAKE_MODULE_PATH ${_use_geant4_dir}/Modules) >> 86 >> 87 #----------------------------------------------------------------------- >> 88 # Include internal use file if it exists. It should only exist in the >> 89 # build tree! >> 90 # >> 91 include(${_use_geant4_dir}/UseGeant4_internal.cmake OPTIONAL) >> 92