# CMakeLists.txt for StAtConverter package. It creates a library with dictionary and a main program cmake_minimum_required(VERSION 3.1 FATAL_ERROR) project(StAtConverter) find_package(Git) 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 MathCore RIO Hist Tree Net MathMore) #---Locate AnalysisTree library find_library(AnalysisTree NAMES AnalysisTreeBase PATHS $ENV{ANALYSISTREE_LIB}) if (AnalysisTree) message(STATUS "AnalysisTree is found: ${AnalysisTree}") endif() if (NOT AnalysisTree) message(FATAL_ERROR "Error: AnalysisTree library wasn't found!") endif() #---Locate StFemtoDst library find_library(StFemtoDst NAMES StFemtoDst PATHS $ENV{STFEMTODST_LIB}) if (StFemtoDst) message(STATUS "StFemtoDst is found: ${StFemtoDst}") endif() if (NOT StFemtoDst) message(FATAL_ERROR "Error: StFemtoDst library wasn't found!") endif() add_definitions(-D_VANILLA_ROOT_) #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY) include(${ROOT_USE_FILE}) add_definitions(${ROOT_CXX_FLAGS}) set(CMAKE_BUILD_TYPE Debug) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall -g") set(ST_AT_CONVERTER_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR} ${ROOT_INLCUDE_DIRS} $ENV{ANALYSISTREE_INC} $ENV{STFEMTODST_INC} ) include_directories(${ST_AT_CONVERTER_INCLUDE_DIRECTORIES}) #---Get all needed libraries together set(ST_AT_CONVERTER_INCLUDE_LIBRARIES ${AnalysisTree} ${ROOT_LIBRARIES} ${StFemtoDst} ) #---Compile converter's executable file add_executable(St2At "${CMAKE_CURRENT_SOURCE_DIR}/StAtConverter.cpp") target_link_libraries(St2At ${ST_AT_CONVERTER_INCLUDE_LIBRARIES})