How to link ROOT libraries using separate CMakeLists.txt

Hi @shadow1OVO ,

and welcome to the ROOT forum!

I don’t think link_directories is enough, that just adds the -L flag to the compilation (i.e. where to look for libraries) but you still need to mention which libraries your target depend on. You do that with target_link_libraries, see the example at Integrating ROOT into CMake projects - ROOT or a full working project such as GitHub - eguiraud/root-readspeed: A tool to measure what throughput can be expected from ROOT for a given application. .

Cheers,
Enrico