Dear ROOT-ers,
I am building a library based on ROOT and managed with CMake, which includes generating dictionaries for some classes with rootcling
. For this, I am using the root_generate_dictionary
helper CMake function.
However, I recently noticed that in certain installations of ROOT 6, there are two CMake files defining this function:
-
$ROOTSYS/cmake/modules/RootNewMacros.cmake
I understand that this provides the “right” version ofroot_generate_dictionary
which should be used? -
$ROOTSYS/etc/cmake/FindROOT.cmake
I guess that it is there cor compatibility reasons? The functionroot_generate_dictionary
defined here is slightly different and does not understand the MODULE keyword.
My CMake configuration for ROOT looks like this:
find_package(ROOT QUIET)
if(ROOT_USE_FILE)
include(${ROOT_USE_FILE})
endif()
I am not setting any CMake-related paths explicitly except for what thisroot.sh
is setting.
My problem is that on ROOT installations where both definitions of root_generate_dictionary
are present, CMake keeps using the one from FindROOT.cmake, which causes incorrect dictionary generation since I am using the MODULE keyword which this version does not expect.
On different systems with different ROOT installations, the 2nd version (FindROOT.cmake, or in fact the whole etc/cmake directory) either is there or not even though I am quite certain that ROOT was installed always in a similar way (out-of source CMake build with prefix set to a local directory, with make install
at the end and sourcing thisroot.sh
).
Therefore, I am wondering about two things:
- Why does CMake load the modules from $ROOTSYS/etc/cmake first rather than from $ROOTSYS/cmake when CMAKE_PREFIX_PATH is set to the same as $ROOTSYS?
- Which factor decides whether $ROOTSYS/etc/cmake/FindROOT.cmake is present in a given ROOT installation or not?
I am not an expert especially in CMake usage, so I would appreciate any hints on what I might be doing wrong.
Many thanks,
Alek
ROOT Version: 6.12, 6.14
Platform: GNU/Linux
Compiler: g++