CMakeLists.txt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # CMakeLists.txt for StAtConverter package. It creates a library with dictionary and a main program
  2. cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
  3. project(StAtConverter)
  4. find_package(Git)
  5. list(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
  6. #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
  7. find_package(ROOT REQUIRED COMPONENTS MathCore RIO Hist Tree Net MathMore)
  8. #---Locate AnalysisTree library
  9. find_library(AnalysisTree NAMES AnalysisTreeBase PATHS $ENV{ANALYSISTREE_LIB})
  10. if (AnalysisTree)
  11. message(STATUS "AnalysisTree is found: ${AnalysisTree}")
  12. endif()
  13. if (NOT AnalysisTree)
  14. message(FATAL_ERROR "Error: AnalysisTree library wasn't found!")
  15. endif()
  16. #---Locate StFemtoDst library
  17. find_library(StFemtoDst NAMES StFemtoDst PATHS $ENV{STFEMTODST_LIB})
  18. if (StFemtoDst)
  19. message(STATUS "StFemtoDst is found: ${StFemtoDst}")
  20. endif()
  21. if (NOT StFemtoDst)
  22. message(FATAL_ERROR "Error: StFemtoDst library wasn't found!")
  23. endif()
  24. add_definitions(-D_VANILLA_ROOT_)
  25. #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
  26. include(${ROOT_USE_FILE})
  27. add_definitions(${ROOT_CXX_FLAGS})
  28. set(CMAKE_BUILD_TYPE Debug)
  29. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall -g")
  30. set(ST_AT_CONVERTER_INCLUDE_DIRECTORIES
  31. ${CMAKE_CURRENT_SOURCE_DIR}
  32. ${ROOT_INLCUDE_DIRS}
  33. $ENV{ANALYSISTREE_INC}
  34. $ENV{STFEMTODST_INC}
  35. )
  36. include_directories(${ST_AT_CONVERTER_INCLUDE_DIRECTORIES})
  37. #---Get all needed libraries together
  38. set(ST_AT_CONVERTER_INCLUDE_LIBRARIES
  39. ${AnalysisTree} ${ROOT_LIBRARIES} ${StFemtoDst}
  40. )
  41. #---Compile converter's executable file
  42. add_executable(St2At "${CMAKE_CURRENT_SOURCE_DIR}/StAtConverter.cpp")
  43. target_link_libraries(St2At ${ST_AT_CONVERTER_INCLUDE_LIBRARIES})