Back to home page

EIC code displayed by LXR

 
 

    


Warning, /geant4/examples/extended/eventgenerator/pythia/decayer6/common/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(${common_prefix}common)
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 # Option to build examples in addition to test
0020 #
0021 option(COMMON_EXAMPLES "Activate building example executables" ON)
0022 
0023 #----------------------------------------------------------------------------
0024 # Setup Geant4 include directories and compile definitions
0025 #
0026 include(${Geant4_USE_FILE})
0027 
0028 #----------------------------------------------------------------------------
0029 # Locate sources and headers for this project
0030 #
0031 include_directories(${PROJECT_SOURCE_DIR}/include
0032                     ${Geant4_INCLUDE_DIR})
0033 file(GLOB sources ${PROJECT_SOURCE_DIR}/src/*.cc)
0034 file(GLOB headers ${PROJECT_SOURCE_DIR}/include/*.hh)
0035 
0036 #----------------------------------------------------------------------------
0037 # Add the library
0038 #
0039 add_library(${common_prefix}common ${sources} ${headers})
0040 target_link_libraries(${common_prefix}common ${Geant4_LIBRARIES} )
0041 
0042 #----------------------------------------------------------------------------
0043 # Add the test executable, and link it to the Geant4 libraries and common library
0044 #
0045 add_executable(${common_prefix}testCommon testCommon.cc )
0046 target_link_libraries(${common_prefix}testCommon ${common_prefix}common ${Geant4_LIBRARIES})
0047 
0048 #----------------------------------------------------------------------------
0049 # Optionally, add the example executables, and link it to the Geant4 libraries and common library
0050 #
0051 if(COMMON_EXAMPLES)
0052   add_executable(exampleCommon exampleCommon.cc )
0053   target_link_libraries(exampleCommon ${common_prefix}common ${Geant4_LIBRARIES})
0054   add_executable(exampleCommonNoVis exampleCommonNoVis.cc )
0055   target_link_libraries(exampleCommonNoVis ${common_prefix}common ${Geant4_LIBRARIES})
0056 endif(COMMON_EXAMPLES)
0057 
0058 #----------------------------------------------------------------------------
0059 # Copy all scripts to the build directory, i.e. the directory in which we
0060 # build detectorConstruction. This is so that we can run the executable directly because it
0061 # relies on these scripts being in the current working directory.
0062 #
0063 set(detectorConstruction_SCRIPTS
0064   init.mac init_vis.mac run.mac vis.mac
0065 )
0066 
0067 foreach(_script ${detectorConstruction_SCRIPTS})
0068   configure_file(
0069     ${PROJECT_SOURCE_DIR}/${_script}
0070     ${PROJECT_BINARY_DIR}/${_script}
0071     COPYONLY
0072   )
0073 endforeach()
0074 
0075 #----------------------------------------------------------------------------
0076 # Install the executable to 'bin' directory under CMAKE_INSTALL_PREFIX
0077 # and the library to 'lib' directory under CMAKE_INSTALL_PREFIX
0078 #
0079 install(TARGETS ${common_prefix}testCommon DESTINATION bin)
0080 if (COMMON_EXAMPLES)
0081   install(TARGETS exampleCommon DESTINATION bin)
0082   install(TARGETS exampleCommonNoVis DESTINATION bin)
0083 endif(COMMON_EXAMPLES)
0084 install(TARGETS ${common_prefix}common DESTINATION lib)