Warning, /geant4/examples/advanced/microelectronics/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 set(name microelectronics)
0005 project(${name})
0006
0007 #----------------------------------------------------------------------------
0008 # Find Geant4 package, activating all available UI and Vis drivers by default
0009 # You can set WITH_GEANT4_UIVIS to OFF via the command line or 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 # Locate sources and headers for this project
0026 #
0027 include_directories(${PROJECT_SOURCE_DIR}/include ${Geant4_INCLUDE_DIR})
0028
0029 file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
0030 file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
0031
0032 #----------------------------------------------------------------------------
0033 # Add the executable, and link it to the Geant4 libraries
0034 #
0035 add_executable(${name} ${name}.cc ${sources} ${headers})
0036 target_link_libraries(${name} ${Geant4_LIBRARIES})
0037
0038 #----------------------------------------------------------------------------
0039 # Copy all scripts to the build directory, i.e. the directory in which we
0040 # build microelectronics. This is so that we can run the executable directly because it
0041 # relies on these scripts being in the current working directory.
0042 #
0043 set(MICROELECTRONICS_SCRIPTS
0044 microelectronics.mac
0045 microelectronics.in
0046 vis.mac
0047 plot.C
0048 )
0049
0050 foreach(_script ${MICROELECTRONICS_SCRIPTS})
0051 configure_file(
0052 ${PROJECT_SOURCE_DIR}/${_script}
0053 ${PROJECT_BINARY_DIR}/${_script}
0054 COPYONLY
0055 )
0056 endforeach()
0057
0058 #----------------------------------------------------------------------------
0059 # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
0060 #
0061 install(TARGETS microelectronics DESTINATION bin)