cmake_minimum_required(VERSION 3.10) # set the project name project(ROOT_HelloWorld) # specify the C++ standard set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) # 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) set(ROOT_DIR "c:/root/vs") find_package(ROOT REQUIRED) #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY) include(${ROOT_USE_FILE}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) # add the executable add_executable(ROOT_HelloWorld ROOT_HelloWorld.cpp) target_link_libraries(ROOT_HelloWorld PUBLIC)