Warning, /geant4/examples/advanced/ChargeExchangeMC/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 cmake_minimum_required(VERSION 3.16...3.27)
0002 include(CMakeDependentOption)
0003
0004 set(name ChargeExchangeMC)
0005 project(${name})
0006
0007 find_package(Geant4 REQUIRED gdml)
0008
0009 option(WITH_GEANT4_UIVIS "Build example with Geant4 UI and Vis drivers" ON)
0010 if(WITH_GEANT4_UIVIS)
0011 find_package(Geant4 REQUIRED ui_all vis_all)
0012 else()
0013 find_package(Geant4 REQUIRED)
0014 endif()
0015
0016 include(${Geant4_USE_FILE})
0017
0018 # Setup of ROOT ANALYSIS : optional.
0019 find_package(ROOT QUIET)
0020 cmake_dependent_option(CEXMC_USE_HISTOGRAMING "Build example with analysis objects" ON "ROOT_FOUND" OFF)
0021
0022 set(EXTRA_LIBRARIES )
0023
0024 # if CEXMC_USE_PERSISTENCY is 'yes' then run and events data can be read and
0025 # written; requires boost::serialize headers and library
0026 option(CEXMC_USE_PERSISTENCY
0027 "Build ${name} with data persistency support
0028 (requires Boost Serialization library)" OFF)
0029
0030 if(CEXMC_USE_PERSISTENCY)
0031 find_package(Boost REQUIRED serialization)
0032 add_definitions(-DCEXMC_USE_PERSISTENCY)
0033 list(APPEND EXTRA_LIBRARIES Boost::serialization)
0034 message(STATUS "Library Boost::serialization was added to the linkage list")
0035 endif()
0036
0037 # if CEXMC_USE_CUSTOM_FILTER is 'yes' then Custom filter can be used for
0038 # existing events data; requires boost::spirit 2.x headers. Notice: if
0039 # CEXMC_USE_PERSISTENCY is not 'yes' then Custom Filter will not be used anyway
0040 cmake_dependent_option(CEXMC_USE_CUSTOM_FILTER
0041 "Build ${name} with custom filter support
0042 (requires Boost Spirit library)" OFF
0043 "CEXMC_USE_PERSISTENCY" OFF)
0044 if(CEXMC_USE_CUSTOM_FILTER)
0045 add_definitions(-DCEXMC_USE_CUSTOM_FILTER)
0046 endif()
0047
0048 # if CEXMC_DEBUG_CUSTOM_FILTER is 'yes' then AST trees will be printed out
0049 cmake_dependent_option(CEXMC_DEBUG_CUSTOM_FILTER
0050 "Debug custom filter" OFF
0051 "CEXMC_USE_CUSTOM_FILTER" OFF)
0052 if(CEXMC_USE_CUSTOM_FILTER)
0053 add_definitions(-DCEXMC_DEBUG_CF)
0054 endif()
0055
0056 # if CEXMC_USE_QGSP_BERT is 'yes' then QGSP_BERT will be used as basic physics,
0057 # otherwise - FTFP_BERT or QGSP_BIC_EMY
0058 option(CEXMC_USE_QGSP_BERT
0059 "Build ${name} with QGSP_BERT physics list
0060 (default physics list is FTFP_BERT)" OFF)
0061 if(CEXMC_USE_QGSP_BERT)
0062 add_definitions(-DCEXMC_USE_QGSP_BERT)
0063 endif()
0064
0065 # if CEXMC_USE_QGSP_BIC_EMY is 'yes' then QGSP_BIC_EMY will be used as basic
0066 # physics, otherwise - FTFP_BERT or QGSP_BERT
0067 cmake_dependent_option(CEXMC_USE_QGSP_BIC_EMY
0068 "Build ${name} with QGSP_BIC_EMY physics list
0069 (default physics list is FTFP_BERT)" OFF
0070 "NOT CEXMC_USE_QGSP_BERT" OFF)
0071 if(CEXMC_USE_QGSP_BIC_EMY)
0072 add_definitions(-DCEXMC_USE_QGSP_BIC_EMY)
0073 endif()
0074
0075 # if CEXMC_DEBUG_TP is 'yes' then additional info will be printed on track
0076 # points data
0077 option(CEXMC_DEBUG_TP
0078 "Print debug information for track points" OFF)
0079 if(CEXMC_DEBUG_TP)
0080 add_definitions(-DCEXMC_DEBUG_TP)
0081 endif()
0082
0083 if(CEXMC_USE_HISTOGRAMING)
0084 EXECUTE_PROCESS(COMMAND root-config --cflags OUTPUT_VARIABLE ROOT_CXX_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
0085 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")
0086 EXECUTE_PROCESS(COMMAND root-config --libs OUTPUT_VARIABLE ROOT_LD_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
0087 set(CMAKE_EXE_LINKER_FLAGS ${ROOT_LD_FLAGS})
0088 endif(CEXMC_USE_HISTOGRAMING)
0089
0090 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${Geant4_INCLUDE_DIR})
0091 file(GLOB sources ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc)
0092
0093 add_executable(${name} ${name}.cc ${sources})
0094
0095 target_link_libraries(${name} ${Geant4_LIBRARIES} ${EXTRA_LIBRARIES})
0096
0097 #----------------------------------------------------------------------------
0098 # Copy all scripts to the build directory, i.e. the directory in which we
0099 # build ChargeExchangeMC. This is so that we can run the executable
0100 # directly because it relies on these scripts being in the current working
0101 # directory.
0102
0103 set(chargeexchangemc_SCRIPTS
0104 batch.mac replay.mac init.mac preinit.mac lht.gdml)
0105
0106 foreach(_script ${chargeexchangemc_SCRIPTS})
0107 configure_file(
0108 ${PROJECT_SOURCE_DIR}/${_script}
0109 ${PROJECT_BINARY_DIR}/${_script}
0110 COPYONLY
0111 )
0112 endforeach()
0113
0114 #----------------------------------------------------------------------------
0115 # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
0116 #
0117 install(TARGETS ${name} DESTINATION bin)
0118