Home | News | Documentation | Download

Looking for slightly more extensive cmake example

Dear Rooters,

I’m putting together a small but not tiny root based analysis using 6.14/00 on Mac OS.

It will probably have a few dozen classes so I’d like the source to live in a few sub modules
that get build into shared libraries with associated include files in the usual way.
I imagine this is a very common scenario in the root world.

I found https://root.cern.ch/how/integrate-root-my-project-cmake, which seems to indicate that
it might be possible to reuse the root cmake build system to accomplish this (“Define useful
ROOT functions and macros”), but provides no further help.

Is there a example or write-up documenting how to do this and which macros from the root build
system can be used and how. From the CMakeLists.txt files in the root source I gleaned potentially
useful macros like ROOT_GLOB_HEADERS, ROOT_GLOB_SOURCES, ROOT_OBJECT_LIBRARY
and ROOT_INSTALL_HEADERS. Can these be used? How to direct the output the toplevel include
and lib directories of my project?

Many thanks in advance,
Maarten.


_ROOT Version: 6.14/00
_Platform: Mac OS Sierra (10.12.6)
_Compiler: gcc version 7.3.0


Hi Marteen,

this looks like an interesting project. At the moment we do not have full documentation of the CMake system even if this might change in the future.
I think the best example to be looked at is the set of ROOT’s CMakeLists.txt files.

Cheers,
Danilo

Hi Maarten,
here is a small project of mine that depends on an external installation of ROOT and uses the technology described at your link to find the ROOT libraries and link them to the project.

You will have to write the CMakeLists for your project yourself (hopefully my link can provide you with a basic starting configuration) – ROOT just provides the CMake technology to link ROOT to your project easily.

Cheers,
Enrico

find ${ROOTSYS}/t[eu]* -name "*[cC][mM][aA][kK][eE]*"

Hi Enrico,

Thanks for the pointer, it definitely helped me forward.

I’m still trying to find the answers to most my questions though. I see your point about the ROOT team just providing the hooks to integrate into CMake. Spending time today trying to sort out how to use ROOT_GENERATE_DICTIONARY in the context of doing install() left me baffled.

At this point having proper documentation for rootcling would be most helpful so I can code up a simpler CMake wrapper myself. (I submitted a jira ticket for this, ROOT-9508)

I found some other threads from about a year ago around the same topic, but no resolution was reached either it seems. Lots of people setting up analysis must run into this I would think?

Hi,
glad that I could help a bit.
So if I understand correctly the question is now fairly specific: how to use ROOT’s CMake function ROOT_GENERATE_DICTIONARY to create dictionaries for your classes in your own project.

This is a different question than the original and it’s very relevant. I suggest you open a new thread in the forum to ask just that, so I can direct the competent people to reply and in the future we can point people with the same question there.

Cheers,
Enrico

EDIT: or, of course, follow the jira ticket you opened and wait for it to be resolved

Hi Maarten,

this will only indirectly help with CMake but for the ROOT6 series the most complete documentation of the dictionary generators is available through the --help switch, i.e. rootcling -h and genreflex --help.

Best,
D

Hi Danilo,

Thanks for the pointer to the help/option information. I’ve started to hack things together based on it.

But it would make a lot of sense to cleanup the switch information such that it shows all options with brief descriptions (like a proper unix utility) and take the (somewhat dense and cryptic) bulk of the help information and put an edited and complete version of it on the web with the aforementioned pages. This is such a core part of the ROOT system that many would benefit from having a place to learn how to use this properly.

Some of my remaining questions:

  • The how and why PCMs, their position in the build dependency chain. Single and/or multiple PCM’s?
  • When and why ‘-split’
  • Is ‘out.cxx’ optional?
  • Can/do PCM’s replace .rootmap files? What is their required relationship (naming, content)
  • How do .rootmap files work, their relationship to dlls

If this information is already online I’d be very grateful for pointers :slight_smile:

Bon weekend,
Maarten.

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