Integrating ROOT into CMake project / Making your CMakeLists.txt ROOT alike

Here, it is described how to add ROOT to your CMake project, however I am still missing some important elements.

  • How do I make sure that I am using the same compiler/linking settings as the installed ROOT. My current solution is:
set (CMAKE_MODULE_PATH "<path_to_ROOT_module_directory>")
include(CheckCompiler)

However, I do not know which ROOT defined variable I should use to get the
correct module path, something like ROOT_MODULE_PATH ?

  • It would be great to get the same library extensions as ROOT libraries have, on
    Apple the default is “.dylib”. However, ROOT library extensions are “.so” and so it is in the rootmap files. I failed to get the right extension in the rootmap file

  • One of the ROOT’s CMake targets is to move the headers of the many libraries to a central location, which is quite helpful for accessing them in other projects. Despite using for my library creation the macro ROOT_STANDARD_LIBRARY_PACKAGE, my headers do not move.
    I figured out that adding

get_property(__allHeaders GLOBAL PROPERTY ROOT_HEADER_TARGETS)
get_property(__allBuiltins GLOBAL PROPERTY ROOT_BUILTIN_TARGETS)
add_custom_target(move_headers ALL DEPENDS ${__allHeaders} ${__allBuiltins})

to my CMakeLists.txt does the magic.
Is this the proper way to accomplish this ?

-Eddy

I guess @oshadura should know the answers to your questions.
Then we put these answers in the page you are referring to.

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