Geant4 Cross Reference |
1 #[============================================ 1 #[=======================================================================[.rst: 2 FindPythia8 2 FindPythia8 3 --------- 3 --------- 4 4 5 Find the Pythia8 event generator headers and l 5 Find the Pythia8 event generator headers and library. 6 6 7 Imported Targets 7 Imported Targets 8 ^^^^^^^^^^^^^^^^ 8 ^^^^^^^^^^^^^^^^ 9 9 10 This module defines the following :prop_tgt:`I 10 This module defines the following :prop_tgt:`IMPORTED` targets: 11 11 12 ``Pythia8::Pythia8`` 12 ``Pythia8::Pythia8`` 13 The Pythia8 ``pythia8`` library, if found. 13 The Pythia8 ``pythia8`` library, if found. 14 14 15 Result Variables 15 Result Variables 16 ^^^^^^^^^^^^^^^^ 16 ^^^^^^^^^^^^^^^^ 17 17 18 This module will set the following variables i 18 This module will set the following variables in your project: 19 19 20 ``Pythia8_FOUND`` 20 ``Pythia8_FOUND`` 21 true if the Pythia8 headers and libraries we 21 true if the Pythia8 headers and libraries were found. 22 22 23 Hints 23 Hints 24 ^^^^^ 24 ^^^^^ 25 25 26 A user may set ``Pythia8_ROOT`` to a Pythia8 i 26 A user may set ``Pythia8_ROOT`` to a Pythia8 installation root to tell this 27 module where to look. 27 module where to look. 28 28 29 #]============================================ 29 #]=======================================================================] 30 30 31 # WE ONLY ALLOW USE OF THIS MODULE IN GEANT4 O 31 # WE ONLY ALLOW USE OF THIS MODULE IN GEANT4 OR py8decayer EXAMPLE 32 if(NOT PROJECT_NAME MATCHES "Geant4|py8decayer 32 if(NOT PROJECT_NAME MATCHES "Geant4|py8decayer") 33 message(FATAL_ERROR "This FindPythia8.cmake 33 message(FATAL_ERROR "This FindPythia8.cmake module is only supported for use in Geant4's py8decayer " 34 "extended example. No support or extension 34 "extended example. No support or extension of this module for use outside of this example " 35 "will be provided.") 35 "will be provided.") 36 endif() 36 endif() 37 37 38 # Look for the header file 38 # Look for the header file 39 find_path(Pythia8_INCLUDE_DIR 39 find_path(Pythia8_INCLUDE_DIR 40 NAMES Pythia8/Pythia.h 40 NAMES Pythia8/Pythia.h 41 HINTS ${Pythia8_ROOT}/include) 41 HINTS ${Pythia8_ROOT}/include) 42 42 43 if(NOT Pythia8_LIBRARY) 43 if(NOT Pythia8_LIBRARY) 44 find_library(Pythia8_LIBRARY 44 find_library(Pythia8_LIBRARY 45 NAMES pythia8 Pythia8 45 NAMES pythia8 Pythia8 46 HINTS ${Pythia8_ROOT}/lib ${Pythia8_ROOT}/ 46 HINTS ${Pythia8_ROOT}/lib ${Pythia8_ROOT}/lib64) 47 endif() 47 endif() 48 48 49 # Determine the version 49 # Determine the version 50 if(Pythia8_INCLUDE_DIR AND EXISTS "${Pythia8_I 50 if(Pythia8_INCLUDE_DIR AND EXISTS "${Pythia8_INCLUDE_DIR}/Pythia8/Pythia.h") 51 file(STRINGS "${Pythia8_INCLUDE_DIR}/Pythia8 51 file(STRINGS "${Pythia8_INCLUDE_DIR}/Pythia8/Pythia.h" PYTHIA8_H REGEX "^#define PYTHIA_VERSION.*$") 52 if(PYTHIA8_H MATCHES "PYTHIA_VERSION ([0-9]\ 52 if(PYTHIA8_H MATCHES "PYTHIA_VERSION ([0-9]\\.[0-9]+)$") 53 set(Pythia8_VERSION "${CMAKE_MATCH_1}") 53 set(Pythia8_VERSION "${CMAKE_MATCH_1}") 54 else() 54 else() 55 set(Pythia8_VERSION "") 55 set(Pythia8_VERSION "") 56 endif() 56 endif() 57 endif() 57 endif() 58 58 59 # handle the QUIETLY and REQUIRED arguments an 59 # handle the QUIETLY and REQUIRED arguments and set Pythia8_FOUND to TRUE if 60 # all listed variables are TRUE 60 # all listed variables are TRUE 61 include(FindPackageHandleStandardArgs) 61 include(FindPackageHandleStandardArgs) 62 find_package_handle_standard_args(Pythia8 62 find_package_handle_standard_args(Pythia8 63 REQUIRED_VARS Pythia8_INCLUDE_DIR Pythia8_LI 63 REQUIRED_VARS Pythia8_INCLUDE_DIR Pythia8_LIBRARY 64 VERSION_VAR Pythia8_VERSION) 64 VERSION_VAR Pythia8_VERSION) 65 65 66 mark_as_advanced(Pythia8_INCLUDE_DIR Pythia8_L 66 mark_as_advanced(Pythia8_INCLUDE_DIR Pythia8_LIBRARY) 67 67 68 # Create imported target 68 # Create imported target 69 if(Pythia8_FOUND) 69 if(Pythia8_FOUND) 70 if(NOT TARGET Pythia8::Pythia8) 70 if(NOT TARGET Pythia8::Pythia8) 71 add_library(Pythia8::Pythia8 UNKNOWN IMPOR 71 add_library(Pythia8::Pythia8 UNKNOWN IMPORTED) 72 set_target_properties(Pythia8::Pythia8 PRO 72 set_target_properties(Pythia8::Pythia8 PROPERTIES 73 INTERFACE_INCLUDE_DIRECTORIES "${Pythia8 73 INTERFACE_INCLUDE_DIRECTORIES "${Pythia8_INCLUDE_DIR}" 74 IMPORTED_LOCATION ${Pythia8_LIBRARY}) 74 IMPORTED_LOCATION ${Pythia8_LIBRARY}) 75 endif() 75 endif() 76 endif() 76 endif()