Usage of `include_directories` with `root_generate_dictionary`

Dear ROOTers,
I’m running into the same issue as described here.
Is the include_directories directive really necessary for root_generate_dictionary?

This kinda defeats the purpose of writing in modern CMake, it would be best if root_generate_dictionary checked the directories passed with the -I option or if it could somehow define a target onto which the user could call target_include_directories.


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.22/08
Platform: CentOS8
Compiler: gcc 9.3


Hi,

One typically generates dictionary together with some library.
Library target is specified via MODULE libtarget parameter of root_generate_dictionary macros.
If one need extra include paths for the dictionary - one just configures them for the library target like:

target_include_directories(libtarget PUBLIC /path/to/the/includes)

Regards,
Sergey

Hi Sergey,
this is exactly what I was looking for. I was already specifying a target via the MODULE option but I wasn’t aware that this set up the include_directories for the dictionary (in fact I was doing this before adding the includes to my target, but it looks like I should declare the dictionary generation after the library target).

Somehow I feel that this usage should be documented somewhere… :thinking:

Thanks again,
Valerio

Hi @valerio.formato ,
in case it helps, see here for the an example suggested usage of ROOT_GENERATE_DICTIONARY (it’s on our to-do list to add a page to the manual dedicated to generating dictionaries): root_dictionaries_tutorial/with_cmake at main · eguiraud/root_dictionaries_tutorial · GitHub

Cheers,
Enrico

Hi Enrico,
ok good to know that some doc is underway :slight_smile:

Valerio

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