Generate dictionary for vector<vector> in CMake file

I want to create a tree with branches of type:
vector< vector>

In my main cpp file I do the following:

    gInterpreter->GenerateDictionary("vector <vector<int> >", "vector");
    gInterpreter->GenerateDictionary("vector <vector<float> >", "vector");
    gInterpreter->GenerateDictionary("vector <vector<double> >", "vector");

which works fine if I run 1 instance of my code.
But I need to run many instances of my code on a cluster with a shared file system.

And I assume what happens is: If 1st instance will not create a dictionary on time, then 2nd instance will try to do the same simultaneously and it is a mess in the end.

I thought it would be very good practice to do it in the Cmake file with root_generate_dictionary(), so libraries are created only once at the compilation moment. But I am struggling to do so, as I am not sure what to pass there as my header arguments.

This is what my attempts look like:

find_package(ROOT 6.18 CONFIG REQUIRED)
include("${ROOT_DIR}/modules/RootNewMacros.cmake")
root_generate_dictionary(test_dict vector.h LINKDEF ./include/LinkDef.h)
add_library(test_lib SHARED test_dict)
target_link_libraries(${PROJECT_NAME} test_lib)

LinkDef.h:

#ifdef __ROOTCLING__
#pragma link C++ class vector < vector<int> > +;
#pragma link C++ class vector < vector<float> > +;
#pragma link C++ class vector < vector<double> > +;
#endif

But it tells me that it cannot find vector.h.
How should I specify include path in this case?

Or is there any robust way to handle this situations?

Any help appreciated,
cheers.

ROOT Version: 6.18/04
Platform: Centos7
Compiler: g++ (GCC) 8.2.0


you need to add:

 target_include_directories(test_dict  PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")

or whatever place you have vector.h

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