Warning, /geant4/examples/extended/hadronic/FlukaCern/ProcessLevel/CrossSection/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(HadronNucleusXS)
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 #----------------------------------------------------------------------------
0024 # Check whether FLUKA should be used or not
0025 set(G4_USE_FLUKA OFF CACHE BOOL "Using FLUKA")
0026 if(G4_USE_FLUKA)
0027 message(STATUS "G4_USE_FLUKA=ON : Using FLUKA interface for building ${PROJECT_SOURCE_DIR}")
0028 add_definitions(-DG4_USE_FLUKA)
0029 find_package(FLUKAInterface REQUIRED)
0030 if(FLUKAInterface_FOUND)
0031 message(STATUS "FLUKA cmake module was found : ${CMAKE_MODULE_PATH}")
0032 else()
0033 message(FATAL_ERROR "FLUKA cmake module was NOT found! Please add one.")
0034 endif()
0035 else()
0036 message(STATUS "G4_USE_FLUKA=OFF : NOT using FLUKA interface for building ${PROJECT_SOURCE_DIR}. \n \
0037 If ever you want to use the FLUKA interface, please repeat cmake command with -DG4_USE_FLUKA=1")
0038 endif()
0039
0040 #----------------------------------------------------------------------------
0041 # Locate sources and headers for this project
0042 #
0043 include_directories(${PROJECT_SOURCE_DIR}/include
0044 ${PROJECT_SOURCE_DIR}/../../utils/include
0045 ${FLUKAInterface_INCLUDE_DIR}
0046 ${Geant4_INCLUDE_DIR})
0047 file(GLOB sources ${PROJECT_SOURCE_DIR}/../../utils/src/*.cc ${PROJECT_SOURCE_DIR}/src/*.cc)
0048 file(GLOB headers ${PROJECT_SOURCE_DIR}/../../utils/include/*.hh ${PROJECT_SOURCE_DIR}/include/*.hh)
0049
0050 #----------------------------------------------------------------------------
0051 # Add the executable, and link it to the Geant4 libraries
0052 #
0053 add_executable(HadronNucleusXS HadronNucleusXS.cc ${sources} ${headers})
0054 target_link_libraries(HadronNucleusXS ${FLUKAInterface_LIBRARIES} ${Geant4_LIBRARIES} )
0055
0056 #----------------------------------------------------------------------------
0057 # Copy all scripts to the build directory, i.e. the directory in which we
0058 # build HadronNucleusXS. This is so that we can run the executable directly because it
0059 # relies on these scripts being in the current working directory.
0060 #
0061 set(HadronNucleusXS_SCRIPTS
0062 all_XS.in
0063 )
0064
0065 foreach(_script ${HadronNucleusXS_SCRIPTS})
0066 configure_file(
0067 ${PROJECT_SOURCE_DIR}/${_script}
0068 ${PROJECT_BINARY_DIR}/${_script}
0069 COPYONLY
0070 )
0071 endforeach()
0072
0073 #----------------------------------------------------------------------------
0074 # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
0075 #
0076 install(TARGETS HadronNucleusXS DESTINATION bin)