The current design of ROOTTEST_GENERATE_REFLEX_DICTIONARY (private) and REFLEX_GENERATE_DICTIONARY (public) leads to an inadvertent race condition (see below).
The question is can the semantic of those macros be "improved" to avoid this kind of error? Do we really need to have 2 targets generated that will create the same file; the target are somename-libgen and somename-dictgen which both generate somename.cxx and thus *must not* be actually used in the same project but are always generated anyway.
and we have ROOTTEST_GENERATE_REFLEX_DICTIONARY which calls REFLEX_GENERATE_DICTIONARY
And REFLEX_GENERATE_DICTIONARY is defined in RootMacros.cmake and line 196 we have:
so because of the ROOTTEST_GENERATE_REFLEX_DICTIONARY(tclass_methods.... and the ROOTTEST_GENERATE_EXECUTABLE(tclass_methods ...
We end up with tclass_methods (the executable) depending ont class_methods.cxx (as an irrelevant aside there is also a class_methods.cpp)
The consequence is that the genreflex rule ends up in the Makefile for the executable …
In addition ROOTTEST_GENERATE_REFLEX_DICTIONARYcreates 2 targets tclass_methods-libgen and tclass_methods-dictgen
The makefiles for both contains the genreflex calls (both depends on tclass_methods.cxx)
It looks like the designer intended for either tclass_methods-libgen or tclass_methods-dictgen to be used and not both. And indeed in roottest the *-dictgen appears to have a Makefile that is never called (i.e *-dictgen is never actually used)
So there are 3 genreflex calls: for the executable, libgen and dictgen.
Last we have:
which means that the test itself depends on the executable and on the libgen (and not the dictgen)
and it does mean that the dictionary generation can run in parallel … since neither the tclass_method-libgen nor the executable depends on the others.
And finally the solution …
The part “executable depends on the source dictionary file” is (clearly) completely unintended and simply due to the 1st parameter of ROOTTEST_GENERATE_EXECUTABLE and the 1st parameter of ROOTTEST_GENERATE_REFLEX_DICTIONARY that happens to be the same spelling …