简单的 ROOT 工程

这是使用目标系统,但不使用字典的最小 ROOT 项目示例。

examples/root-simple/CMakeLists.txt

  1. cmake_minimum_required(VERSION 3.1...3.21)
  2. project(RootSimpleExample LANGUAGES CXX)
  3. # Finding the ROOT package
  4. find_package(ROOT 6.16 CONFIG REQUIRED)
  5. # Adding an executable program and linking to needed ROOT libraries
  6. add_executable(RootSimpleExample SimpleExample.cxx)
  7. target_link_libraries(RootSimpleExample PUBLIC ROOT::Physics)

examples/root-simple/SimpleExample.cxx

  1. #include <TLorentzVector.h>
  2. int main() {
  3. TLorentzVector v(1,2,3,4);
  4. v.Print();
  5. return 0;
  6. }