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 # The recommended Geant4 compiler flags are also added to CMAKE_CXX_FLAGS >> 18 # but duplicated flags are NOT removed. >> 19 # >> 20 # Advanced users requiring special sets of flags, or the removal of >> 21 # duplicate flags should therefore *not* use this file, preferring the >> 22 # direct use of the Geant4_XXXX variables set by the Geant4Config file. >> 23 # >> 24 # The last thing the module does is to optionally include an internal Use >> 25 # file. This file can contain variables, functions and macros for strict >> 26 # internal use in Geant4, such as building and running validation tests. >> 27 # >> 28 >> 29 #----------------------------------------------------------------------- >> 30 # We need to set the compile definitions and include directories >> 31 # >> 32 add_definitions(${Geant4_DEFINITIONS}) >> 33 include_directories(${Geant4_INCLUDE_DIRS}) >> 34 >> 35 #----------------------------------------------------------------------- >> 36 # Because Geant4 is sensitive to the compiler flags, let's set the base >> 37 # set here. This reproduces as far as possible the behaviour of the >> 38 # original makefile system. >> 39 # >> 40 set(CMAKE_CXX_FLAGS "${Geant4_CXX_FLAGS}") >> 41 set(CMAKE_CXX_FLAGS_DEBUG "${Geant4_CXX_FLAGS_DEBUG}") >> 42 set(CMAKE_CXX_FLAGS_MINSIZEREL "${Geant4_CXX_FLAGS_MINSIZEREL}") >> 43 set(CMAKE_CXX_FLAGS_RELEASE "${Geant4_CXX_FLAGS_RELEASE}") >> 44 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${Geant4_CXX_FLAGS_RELWITHDEBINFO}") >> 45 set(CMAKE_EXE_LINKER_FLAGS "${Geant4_EXE_LINKER_FLAGS}") >> 46 >> 47 #----------------------------------------------------------------------- >> 48 # Locate ourselves >> 49 # >> 50 get_filename_component(_use_geant4_dir ${CMAKE_CURRENT_LIST_FILE} PATH) >> 51 >> 52 #----------------------------------------------------------------------- >> 53 # Append the local module path to CMAKE_MODULE_PATH to automatically >> 54 # make FindXXX modules for examples available >> 55 # >> 56 list(APPEND CMAKE_MODULE_PATH ${_use_geant4_dir}/Modules) >> 57 >> 58 #----------------------------------------------------------------------- >> 59 # Include internal use file if it exists. It should only exist in the >> 60 # build tree! >> 61 # >> 62 include(${_use_geant4_dir}/UseGeant4_internal.cmake OPTIONAL) >> 63