Includes in a compiled TRint application


I am facing a problem using a TRint application. My app is creating a root terminal, with all my libraries already loaded inside. This app is build in a cmake file.

What I don’t understand, is that when I execute the application and I look to the includes that have been automatically added, there is all the sources and build path that are added. So if my build directory is no more present, I got error messages. Here the output of the “.I” command to show the includes:


How these includes are generated, and how to proceed to remove them ?

Thanks in advance


It looks like a cmake issue ? right ? @bellenot may know.

Actually it seems to be done by the ROOT_GENERATE_DICTIONARY function that adds automatically the source an build paths to the INCLUDE_DIRECTORIES

1 Like


I finally solved the problem. I put the solution here for those that could be interested:

1 - to remove the includes coming from the build and source directory, use the option OPTIONS -noIncludePaths in the ROOT_GENERATE_DICTIONARY fonction

But it is then necessary to define the ROOT_INCLUDE_PATH env variable to be able to find the headers.

2 - Even doing this still let traces on the source directory when building the dictionaries. So if the source directory is no more existing, the TRint print plenty of error messages. The solution for this is to gives to the ROOT_GENERATE_DICTIONARY relative paths for the includes instead of absolute, like in this example:

#---GENERATE_ROOT_DICTIONARY(libname LINKDEF [name of LinkDef.h] HEADERS [toto.h titi.h ...] DEPENDENCIES [lib1 lib2])
#---Generate ROOT dictionary & rootmap.
#   For ROOT6 we generate the .pcm file too.
#   rootmap and pcm will be installed in ${CMAKE_INSTALL_LIBDIR}


    #--remove source path from header filenames to be given to dictionary generator
    foreach(head ${ARG_HEADERS})
      get_filename_component(no_dir_head ${head} NAME)
      set(dictgen_headers ${dictgen_headers} ${no_dir_head})

    ROOT_GENERATE_DICTIONARY(G__${libname} ${dictgen_headers} MODULE ${libname} LINKDEF ${ARG_LINKDEF} OPTIONS -noIncludePaths)
    set_source_files_properties(${libname}_rdict.pcm ${libname}.rootmap PROPERTIES GENERATED TRUE)
    set_source_files_properties(G__${libname}.cxx G__${libname}.h  PROPERTIES GENERATED TRUE)


Using this fonction, all works correctly



1 Like