# CMakeLists.txt for the package. It creates a library with dictionary and a main program cmake_minimum_required(VERSION 3.0 FATAL_ERROR) project(FitHelpers) # 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 Matrix MathCore RooFit RooFitCore RooStats HistFactory RIO Core Tree Hist Net) include_directories(${ROOT_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/FitHelpers) include(${ROOT_USE_FILE}) include(header-deps.cmake) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_INSTALL_LIBDIR ${CMAKE_BINARY_DIR}/lib) ROOT_GENERATE_DICTIONARY( G__FitHelpers FitHelpers/*.h LINKDEF Root/LinkDef.h) # set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) #---Create a shared library with geneated dictionary AUX_SOURCE_DIRECTORY(Root SRC_CODE) add_library(FitHelpers SHARED ${SRC_CODE} G__FitHelpers.cxx) # target_compile_definitions(FitHelpersLib PUBLIC $<$:FitHelpers_DEBUG=0>) # target_compile_definitions(FitHelpersLib PUBLIC $<$:FitHelpers_DEBUG=1>) # target_include_directories(FitHelpersLib INTERFACE "${CMAKE_INSTALL_PREFIX}/FitHelpers") target_link_libraries(FitHelpers ${ROOT_LIBRARIES} ${ROOT_RooFit_LIBRARY}) # file(GLOB HEADER_files "FitHelpers/*.h") # install(FILES ${HEADER_files} DESTINATION FitHelpers) # install(TARGETS FitHelpersLib DESTINATION lib EXPORT FitHelpersLib-export) # install(EXPORT FitHelpersLib-export DESTINATION lib/cmake/FitHelpers) # export(EXPORT FitHelpersLib-export NAMESPACE FitHelpers:: FILE FitHelpersConfig.cmake) # Create SomeLibConfig.cmake # export(PACKAGE FitHelpersLib) # Store location of SomeLibConfig.cmake # install(TARGETS FitHelpers DESTINATION ${CMAKE_BINARY_DIR}/lib) # file (INSTALL # ${CMAKE_CURRENT_BINARY_DIR}/libFitHelpers_rdict.pcm # ${CMAKE_CURRENT_BINARY_DIR}/libFitHelpers.rootmap # DESTINATION ${CMAKE_BINARY_DIR}/lib) foreach( exec quickScan ) add_executable( ${exec} util/${exec}.cxx ) target_link_libraries(${exec} FitHelpers) endforeach() # set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)