Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/extended/eventgenerator/HepMC/HepMCEx01/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(HepMCEx01)
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 # Find HepMC (required package)
0025 #
0026 find_package(HepMC REQUIRED)
0027 
0028 #----------------------------------------------------------------------------
0029 # Find Pythia6 (optional package)
0030 #
0031 find_package(Pythia6 QUIET)
0032 if(Pythia6_FOUND)
0033   message(STATUS "G4 Examples: Pythia6 found. --> HepMCEx01 example with Pythia6 enabled.") 
0034 endif()
0035 
0036 #----------------------------------------------------------------------------
0037 # Locate sources and headers for this project
0038 #
0039 include_directories(${PROJECT_SOURCE_DIR}/include 
0040                     ${Geant4_INCLUDE_DIR}
0041                     ${HEPMC_INCLUDE_DIR})
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(HepMCEx01 HepMCEx01.cc ${sources} ${headers})
0049 target_compile_definitions(HepMCEx01 PRIVATE $<$<BOOL:${Pythia6_FOUND}>:G4LIB_USE_PYTHIA>)
0050 #target_link_libraries(HepMCEx01 ${Geant4_LIBRARIES}
0051 #                      ${HEPMC_LIBRARIES} ${HEPMC_FIO_LIBRARIES}
0052 #                      $<$<BOOL:${Pythia6_FOUND}>:Pythia6::Pythia6>
0053 #                      gfortran)
0054 target_link_libraries(HepMCEx01 ${Geant4_LIBRARIES}
0055                       ${HEPMC_LIBRARIES} ${HEPMC_FIO_LIBRARIES}
0056                       $<$<BOOL:${Pythia6_FOUND}>:Pythia6::Pythia6>
0057                       )
0058 
0059 # if pythia is compiled with g77, link with -lg2c instead.
0060 #target_link_libraries(HepMCEx01 ${Geant4_LIBRARIES}
0061 #                      ${HEPMC_LIBRARIES} ${HEPMC_FIO_LIBRARIES}
0062 #                      $<$<BOOL:${Pythia6_FOUND}>:Pythia6::Pythia6>
0063 #                      g2c)
0064 
0065 #----------------------------------------------------------------------------
0066 # Copy all scripts to the build directory, i.e. the directory in which we
0067 # build HepMCEx01. This is so that we can run the executable directly because it
0068 # relies on these scripts being in the current working directory.
0069 #
0070 set(HepMCEx01_SCRIPTS
0071     hepmc_ascii.in hepmc_ascii.out hepmc_pygen.in hepmc_pygen.out pyh4mu.mac pyset.mac vis.mac
0072     data/example_MyPythia.dat
0073   )
0074 
0075 foreach(_script ${HepMCEx01_SCRIPTS})
0076   configure_file(
0077     ${PROJECT_SOURCE_DIR}/${_script}
0078     ${PROJECT_BINARY_DIR}/${_script}
0079     COPYONLY
0080     )
0081 endforeach()
0082 
0083 #----------------------------------------------------------------------------
0084 # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
0085 #
0086 install(TARGETS HepMCEx01 DESTINATION bin)
0087