Hi,
I am trying to move a large, historic code-base using root from hand-written Makefiles to cmake.
I am having troubles understanding how to correctly use root_generate_dictionary
and how to properly setup the project so that the generated files are installed into CMAKE_INSTALL_PREFIX
at a location where root and the generated executables are looking for them.
The library is split into multiple subdirectories, for which – at least in the current setup – each directory has its own dictionary / LinkDef.h / Incl.h .
In the top-level directory, I have
add_library(myproject)
root_generate_dictionary(G__myproject MyProjcetIncl.h MODULE myproject MULTIDICT LINKDEF MyProjectLinkDef.h
add_subdirectory(foo)
add_subdirectory(bar)
In each of the subdirectories, there are FooLinkDef.h
and FooInc.h
files, and i put the following in the CMakeLists.txt
of those:
target_sources(myproject <source files>)
target_include_directories(myproject PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDE_DIR}/foo>
)
root_generate_dictionary(FooDict FooIncl.h MULTIDICT MODULE myproject LINKDEF FooLinkDef.h)
This seems to work, has a couple of issues though:
- The pcm files are generated in the subdirectories of the build dir, but root seems to expect them at the base, next to the
libmyproject.so
. - The pcm files are not installed, although looking into the code, they should be…
- In general, I found the documentation on how to use
root_generate_dictionary
lacking and hard to understand, especially for the case of multiple dictionaries. The arguments are not explained in the cmake macro
Is the general setup ok?
How can I address the mentioned issues?
Any help would be greatly appreciated.
ROOT Version: 6.28/04
Platform: Ubuntu 22.04
Compiler: gcc 11.4