Warning, /geant4/examples/advanced/xray_fluorescence/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(xray_fluorescence)
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
0009 # ccmake/cmake-gui
0010 # to build a batch mode only executable
0011 #
0012 option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
0013 if(WITH_GEANT4_UIVIS)
0014 find_package(Geant4 REQUIRED ui_all vis_all)
0015 else()
0016 find_package(Geant4 REQUIRED)
0017 endif()
0018
0019 #----------------------------------------------------------------------------
0020 # Setup Geant4 include directories and compile definitions
0021 #
0022 include(${Geant4_USE_FILE})
0023
0024
0025 #----------------------------------------------------------------------------
0026 #
0027 set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
0028
0029 #----------------------------------------------------------------------------
0030 # Locate sources and headers for this project
0031 #
0032 include_directories(${PROJECT_SOURCE_DIR}/include
0033 ${Geant4_INCLUDE_DIR})
0034 file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
0035 file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
0036
0037 #----------------------------------------------------------------------------
0038 # Add the executable, and link it to the Geant4 libraries
0039 #
0040 add_executable(XrayFluo XrayFluo.cc ${sources} ${headers})
0041 target_link_libraries(XrayFluo ${Geant4_LIBRARIES} )
0042
0043 #----------------------------------------------------------------------------
0044 # Copy all scripts to the build directory, i.e. the directory in which we
0045 # build xray_fluorescence. This is so that we can run the executable directly because it
0046 # relies on these scripts being in the current working directory.
0047 #
0048 set(xray_fluorescence_SCRIPTS
0049 initInter.mac livermore.mac vis.mac SILIefficiency.dat SILIresponse.dat
0050 B_flare.dat C_flare.dat M_flare.dat response.dat
0051 )
0052
0053 foreach(_script ${xray_fluorescence_SCRIPTS})
0054 configure_file(
0055 ${PROJECT_SOURCE_DIR}/${_script}
0056 ${PROJECT_BINARY_DIR}/${_script}
0057 COPYONLY
0058 )
0059 endforeach()
0060
0061 #----------------------------------------------------------------------------
0062 # Add program to the project targets
0063 # (this avoids the need of typing the program name after make)
0064 #
0065 add_custom_target(xray_fluorescence DEPENDS XrayFluo)
0066
0067 #----------------------------------------------------------------------------
0068 # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
0069 #
0070 install(TARGETS XrayFluo DESTINATION bin)
0071