Warning, /geant4/examples/extended/eventgenerator/HepMC/HepMCEx02/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 example 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 target_compile_definitions(example_MyPythia PRIVATE $<$<BOOL:${Pythia6_FOUND}>:G4LIB_USE_PYTHIA>)
0031 add_executable(example_MyPythia example_MyPythia.cxx)
0032 target_link_libraries(example_MyPythia
0033 ${HEPMC_LIBRARIES} ${HEPMC_FIO_LIBRARIES}
0034 $<$<BOOL:${Pythia6_FOUND}>:Pythia6::Pythia6>
0035 gfortran)
0036
0037 # if pythia is compiled with g77, link with -lg2c instead.
0038 #target_link_libraries(example_MyPythia
0039 # ${HEPMC_LIBRARIES} ${HEPMC_FIO_LIBRARIES}
0040 # $<$<BOOL:${Pythia6_FOUND}>:Pythia6::Pythia6>
0041 # g2c)
0042
0043 #----------------------------------------------------------------------------
0044 # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
0045 #
0046 install(TARGETS example_MyPythia DESTINATION bin)
0047