Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/advanced/underground_physics/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 #----------------------------------------------------------------------------
0002 # Setup the project
0003 cmake_minimum_required(VERSION 3.16...3.27)
0004 project(underground_physics)
0005 
0006 #----------------------------------------------------------------------------
0007 # Find Geant4 package, activating all available UI and Vis drivers by default
0008 # You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
0009 # to build a batch mode only executable
0010 #
0011 option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
0012 if(WITH_GEANT4_UIVIS)
0013   find_package(Geant4 REQUIRED ui_all vis_all)
0014 else()
0015   find_package(Geant4 REQUIRED)
0016 endif()
0017 
0018 #----------------------------------------------------------------------------
0019 # Setup Geant4 include directories and compile definitions
0020 #
0021 include(${Geant4_USE_FILE})
0022 
0023 #Check here for DMXENV_GPS_USE
0024 #Use GPS if the environment variable is set, and the user has *not* supplied the CMake
0025 #command line argument. Otherwise, the argument of the command line has the priority.
0026 #
0027 if("$ENV{DMXENV_GPS_USE}" AND NOT DEFINED DMXENV_GPS_USE)
0028   set(DMXENV_GPS_USE_DEFAULT ON)
0029 else()
0030   set(DMXENV_GPS_USE_DEFAULT ${DMXENV_GPS_USE})
0031 endif()
0032 
0033 option(DMXENV_GPS_USE "Build DMX with support for GPS" ${DMXENV_GPS_USE_DEFAULT})
0034 mark_as_advanced(DMXENV_GPS_USE)
0035 
0036 if(DMXENV_GPS_USE)
0037   add_definitions(-DDMXENV_GPS_USE)
0038 endif()
0039 
0040 #----------------------------------------------------------------------------
0041 # Locate sources and headers for this project
0042 #
0043 include_directories(${PROJECT_SOURCE_DIR}/include
0044                     ${Geant4_INCLUDE_DIR})
0045 file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
0046 file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
0047 
0048 #----------------------------------------------------------------------------
0049 # Add the executable, and link it to the Geant4 libraries
0050 #
0051 add_executable(DMX DMX.cc ${sources} ${headers})
0052 target_link_libraries(DMX ${Geant4_LIBRARIES})
0053 
0054 #----------------------------------------------------------------------------
0055 # Copy all scripts to the build directory, i.e. the directory in which we
0056 # build underground_physics. This is so that we can run the executable directly because it
0057 # relies on these scripts being in the current working directory.
0058 #
0059 set(underground_physics_SCRIPTS
0060     alpha_1000.mac alpha.mac ambe_spectrum.mac gamma_1000.mac gamma_2000.mac gamma_low.mac gamma.mac initInter.mac neutron.mac stt.mac stt.out stt_pmt_ref.out stt_ref.out wired.mac
0061   )
0062 
0063 foreach(_script ${underground_physics_SCRIPTS})
0064   configure_file(
0065     ${PROJECT_SOURCE_DIR}/${_script}
0066     ${PROJECT_BINARY_DIR}/${_script}
0067     COPYONLY
0068     )
0069 endforeach()
0070 
0071 #----------------------------------------------------------------------------
0072 # Add program to the project targets
0073 # (this avoids the need of typing the program name after make)
0074 #
0075 add_custom_target(underground_physics DEPENDS DMX)
0076 
0077 #----------------------------------------------------------------------------
0078 # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
0079 #
0080 install(TARGETS DMX DESTINATION bin)
0081