Cmake: root_generate_dictionary naming rootmap and pcm file using target output name instead of target name?


Is there a way to get the CMake macro root_generate_dictionary to name its output files (rootmap and pcm) after the target output name (OUTPUT_NAME target property) instead of the default/current target name itself ?


ROOT Version: >= 6.28
Platform: Not relevant
Compiler: Not relevant

Dear @laurent.aphecetche ,

Maybe @bellenot knows more about this.


Hi @laurent.aphecetche, I have to check, but what problem do you want to solve exactly?


Well, I have a project specific cmake helper function xxx_add_library which encapsulates a series of steps that one usually have to do to create a library (call cmake own add_library, sets a few properties, create a root dictionary if there’s a linkdef, install the lib, etc…).
In this function I have something like :

set_target_properties(${target} PROPERTIES OUTPUT_NAME ${basename}


       "${A_ROOT_DICTIONARY}" ${A_LINKDEF} MODULE ${target})

where target is computed from some basename (e.g. adding a project-specific prefix), and thus is not the name of the output artifact. Doing so I end up with 3 files installed, e.g. if basename=MyLib and target=prefix-long-name-derived-from-MyLib:


whereas I’d like to have :


OK, thanks for the explanation. We’ll see what can be done

So looking at the ROOT_GENERATE_DICTIONARY in RootMacros.cmake, I see:

  set(library_name ${libprefix}${library_target_name}${libsuffix})
  set(newargs -s ${library_output_dir}/${library_name})
  set(rootmap_name ${library_output_dir}/${libprefix}${library_target_name}.rootmap)
  set(pcm_name ${library_output_dir}/${libprefix}${library_target_name}_rdict.pcm)

So it looks like they should have the same base name, or did I miss something?

as far as I understand this part of the RootMacros.cmake the problem is that ${library_target_name} is the value of the MODULE parameter given to the macro and not the artifact name (set with OUTPUT_NAME)

OK, thanks, I’ll investigate.


An extra question if I may …
Do I understand correctly that the rootmap files are actually no longer needed (since root 6.16 or something) ? (and if that’s indeed the case, then why root_generate_dictionary is generating them) ?


I think @Axel can give more details about that

Since then, we have to mode for dictionary. The legacy mode that still require rootmap file and for the header files to present/accessible at run-time. The new C++ module based mode where instead of the rootmap file and header we generate the pre-compiled module file corresponding to those headers. Use the MODULE option to request the new mode.

1 Like

Hi Philippe,

Hum… I do use the MODULE option (see above) but still I have both outputs.

1 Like

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