Warning, /geant4/examples/extended/medical/dna/chem4/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 cmake_minimum_required(VERSION 3.16...3.27)
0002
0003 #----------------------------------------------------------------------------
0004
0005 project(chem4)
0006
0007 #----------------------------------------------------------------------------
0008 # Build plot program if ROOT built with GUI via CMake is found
0009 #
0010 find_package(ROOT COMPONENTS Gui QUIET)
0011 #message(STATUS ROOT_USE_FILE " ${ROOT_USE_FILE}")
0012 if(ROOT_FOUND AND ROOT_USE_FILE)
0013 set(BUILD_CHEM4_PLOT ON)
0014 add_subdirectory(plot)
0015 else()
0016 message("-- G4 Examples : The chem4/plot requires ROOT built with GUI via CMake, plot is disabled")
0017 endif()
0018
0019 #----------------------------------------------------------------------------
0020 # Find Geant4 package, activating all available UI and Vis drivers by default
0021 # You can set WITH_GEANT4_UIVIS to OFF via the command line or ccmake/cmake-gui
0022 # to build a batch mode only executable
0023 #
0024 option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
0025 if(WITH_GEANT4_UIVIS)
0026 find_package(Geant4 REQUIRED ui_all vis_all)
0027 else()
0028 find_package(Geant4 REQUIRED)
0029 endif()
0030
0031 #----------------------------------------------------------------------------
0032 # Setup Geant4 include directories and compile definitions
0033 # Setup include directory for this project
0034 #
0035 include(${Geant4_USE_FILE})
0036 include_directories(${PROJECT_SOURCE_DIR}/include)
0037
0038 #----------------------------------------------------------------------------
0039 # Locate sources and headers for this project
0040 # NB: headers are included so they will show up in IDEs
0041 #
0042 file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
0043 file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
0044
0045 #----------------------------------------------------------------------------
0046 # Add the executable, and link it to the Geant4 libraries
0047 #
0048 add_executable(chem4 chem4.cc ${sources} ${headers})
0049 target_link_libraries(chem4 ${Geant4_LIBRARIES})
0050
0051 #----------------------------------------------------------------------------
0052 # Copy all scripts to the build directory, i.e. the directory in which we
0053 # build chem4_proj. This is so that we can run the executable directly because
0054 # it relies on these scripts being in the current working directory.
0055 #
0056 file(GLOB CHEM4_SCRIPTS
0057 ${PROJECT_SOURCE_DIR}/*.in
0058 ${PROJECT_SOURCE_DIR}/*.mac)
0059 #message(STATUS CHEM4_SCRIPTS " ${CHEM4_SCRIPTS}")
0060
0061 foreach(_script ${CHEM4_SCRIPTS})
0062 configure_file(
0063 ${_script}
0064 ${PROJECT_BINARY_DIR}/.
0065 COPYONLY
0066 )
0067 endforeach()
0068
0069 source_group("macros" FILES ${CHEM4_SCRIPTS})
0070 target_sources(chem4 PUBLIC ${CHEM4_SCRIPTS})
0071
0072 #----------------------------------------------------------------------------
0073 # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
0074 #
0075 install(TARGETS chem4 DESTINATION bin )
0076
0077 #----------------------------------------------------------------------------
0078 # For internal Geant4 use - but has no effect if you build this
0079 # example standalone
0080 #
0081 #project(chem4_proj)
0082 #add_custom_target(chem4_proj DEPENDS chem4 plotG)
0083
0084 if(BUILD_CHEM4_PLOT)
0085 add_dependencies(plotG chem4)
0086 endif()