# CMakeLists.txt for event package. It creates a library with dictionary and a main program cmake_minimum_required(VERSION 3.0 FATAL_ERROR) project(MyProject) # You need to tell CMake where to find the ROOT installation. This can be done in a number of ways: # - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake # - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS}) #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS) find_package(ROOT REQUIRED COMPONENTS RIO) #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY) include(${ROOT_USE_FILE}) #---Locate other external packages find_package(Boost REQUIRED) include_directories( ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${BASE_INCLUDE_DIRECTORIES} ${ATTPCROOTPATH}/include ${CMAKE_SOURCE_DIR}/MCSrc) link_directories( ${FAIRROOT_LIBRARY_DIR} ${ATTPCROOTPATH}/build/lib) #---Generate the dictionary (G__MCSrc.cxx G__MCSrc.pcm) ROOT_GENERATE_DICTIONARY(G__MCSrc MCSrc.hh LINKDEF MCSrcLinkDef.h) #---Create a shared library with geneated dictionary add_library(MCSrc SHARED G__MCSrc.cxx) target_link_libraries(MCSrc ${ROOT_LIBRARIES} ATTPCReco FairTools Base) #---Create a main program using the library add_executable(MCExe MCSrc.cc) target_link_libraries(MCExe MCSrc)