Warning, /geant4/examples/basic/B1/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 #----------------------------------------------------------------------------
0002 # Setup the project
0003 #
0004 cmake_minimum_required(VERSION 3.16...3.27)
0005 project(B1)
0006
0007 #----------------------------------------------------------------------------
0008 # Find Geant4 package, activating all available UI and Vis drivers by default
0009 # See the documentation for a guide on how to enable/disable specific components
0010 #
0011 find_package(Geant4 REQUIRED ui_all vis_all)
0012
0013 #----------------------------------------------------------------------------
0014 # Locate sources and headers for this project
0015 # NB: headers are included so they will show up in IDEs
0016 #
0017 file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
0018 file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
0019
0020 #----------------------------------------------------------------------------
0021 # Add the executable, use our local headers, and link it to the Geant4 libraries
0022 #
0023 add_executable(exampleB1 exampleB1.cc ${sources} ${headers})
0024 target_include_directories(exampleB1 PRIVATE include)
0025 target_link_libraries(exampleB1 PRIVATE ${Geant4_LIBRARIES})
0026
0027 #----------------------------------------------------------------------------
0028 # Copy all scripts to the build directory, i.e. the directory in which we
0029 # build B1. This is so that we can run the executable directly because it
0030 # relies on these scripts being in the current working directory.
0031 #
0032 set(EXAMPLEB1_SCRIPTS
0033 exampleB1.in
0034 exampleB1.out
0035 init_vis.mac
0036 run1.mac
0037 run2.mac
0038 vis.mac
0039 )
0040
0041 foreach(_script ${EXAMPLEB1_SCRIPTS})
0042 configure_file(
0043 ${PROJECT_SOURCE_DIR}/${_script}
0044 ${PROJECT_BINARY_DIR}/${_script}
0045 COPYONLY
0046 )
0047 endforeach()