Warning, /geant4/examples/extended/eventgenerator/HepMC/HepMCEx01/data/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(example_MyPythia)
0005
0006 find_package(Geant4 REQUIRED)
0007 include(${Geant4_USE_FILE})
0008
0009 #----------------------------------------------------------------------------
0010 # Find HepMC (required package)
0011 #
0012 find_package(HepMC QUIET)
0013 if(NOT HEPMC_FOUND)
0014 message(STATUS "G4 Examples: HepMC package not found. --> example_MyPythia disabled")
0015 return()
0016 endif()
0017
0018 #----------------------------------------------------------------------------
0019 # Find Pythia6 (optional package)
0020 #
0021 find_package(Pythia6 QUIET)
0022 if(Pythia6_FOUND)
0023 message(STATUS "G4 Examples: Pythia6 found. --> example_MyPythia with Pythia6 enabled.")
0024 endif()
0025
0026 #----------------------------------------------------------------------------
0027 # Add the executable, and link it to the Geant4 libraries
0028 #
0029 include_directories(${HEPMC_INCLUDE_DIR})
0030 add_executable(example_MyPythia example_MyPythia.cxx)
0031 target_compile_definitions(example_MyPythia PRIVATE $<$<BOOL:${Pythia6_FOUND}>:G4LIB_USE_PYTHIA>)
0032 target_link_libraries(example_MyPythia
0033 ${HEPMC_LIBRARIES} ${HEPMC_FIO_LIBRARIES}
0034 ${Pythia6_LIBRARIES}
0035 $<$<BOOL:${Pythia6_FOUND}>:Pythia6::Pythia6>
0036 gfortran)
0037
0038 # if pythia is compiled with g77, link with -lg2c instead.
0039 #target_link_libraries(example_MyPythia
0040 # ${HEPMC_LIBRARIES} ${HEPMC_FIO_LIBRARIES}
0041 # ${Pythia6_LIBRARIES} g2c)
0042
0043 #----------------------------------------------------------------------------
0044 # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
0045 #
0046 install(TARGETS example_MyPythia DESTINATION bin)
0047