Root_generate_dictionary ignores OPTIONS -I when searching for headers

The root_generate_dictionary macro allows to set the include folders for rootcling using the OPTIONS parameter. However, the include folders passed in this way are ignored by the macro when searching for the given headers, forcing the user to define them folder-wise with a include_directories command.

For example, consider this simple reproducer (563 Bytes): when configuring it with cmake I get this error:

CMake Error at /home/mori/software/install/ROOT_6.20.00/cmake/RootMacros.cmake:333 (message):
  Cannot find header MyClass.h to generate dictionary MyClassDict for.  Did
  you forget to set the INCLUDE_DIRECTORIES property for the current
Call Stack (most recent call first):
  CMakeLists.txt:10 (root_generate_dictionary)

while uncommenting the include_directories comamnd in CMakeLists.txt it works.

So is this the intended behavior? As reported by @Axel in this thread I understood that passing include folders with OPTIONS -I should be correct procedure, without needing to set the include_directories (which will affect also other targets in the folder in a potentially undesired way). But the cmake error message is quite explicit about the need to set it, so I’m a bit confused.

Thanks in advance for any clarification.

ROOT Version: 6.20.00
Platform: Not Provided
Compiler: Not Provided

Hello @Nicola_Mori,

After a brief inspection of RootMacros.cmake, it seems that that the root_generate_dictionary function uses find_file() -see here- that searches for headers in the target’s include path, regardless of the -I... options passed to rootcling.

Additionally, using include_directories() seems to be the way recommended on the documentation here.

@Axel, @pcanal, is that the intended behavior? Should we change that?


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