You are here

Can I integrate ROOT into my CMake build?

I use CMake to build my own code, and I would like to use ROOT in that code. Is there a way to wire ROOT into the CMake build files? Something like FindROOT.cmake?

Absolutely. The CMake command find_package() will set all needed ROOT related variables, which can be used to compile and link one's own code. An example from the ROOT Event example (found in root/test) can be downloaded here. Just un-tar the attached file and run:

cd event/build
cmake ..

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
1 + 12 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.