Check for build option with CMake when used as dependency


ROOT Version: 6.14/04


Normally I would write

find_package(ROOT 6.14 REQUIRED Core Hist... )

How can I check if, for example, ROOT is compiled with Qt? Something like detecting the qt=ON/OFF flag given when building ROOT. Is there a component for that? I can’t see something similar by looking in ROOTConfig-targets.cmake.

Depends on what you want. You can check for specific components like GQt, QtRoot, etc. Those are for Qt4. There are also newer classes based on Qt5, like ROOTQt5WebDisplay. Each library has the matching component that you can ask for as in your example above. If you just want to know if it’s there, try root-config --features and check for *qt* in component names.

Oh, my fault, didn’t realize that in ROOTConfig-targets.cmake only the compiled targets are listed, not the full list…

I’m writing CMake files for code that someone else wrote, so actually I don’t know precisely which Qt-based components are used, I just remember trying to compile the project once and getting undefined references for objects in TQObject. After recompiling ROOT with qt=ON everything worked fine, that’s why I want to require something more in find_package. I guess I have to understand what is exactly needed in the code.

By the way, is there a full list of targets somewhere? In general, how can I understand which package I need? Is there a target for each folder in the root source repo?

Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.