Skip to content

Avoid name clashes from targets in multiple dune modules

Summary

When compiling multiple dune modules, e.g., by using cmakes add_subdirectory command, or FetchContent utilities, it happes that two modules are added that define the same cmake targets. CMake will complain about that. We have started to fix a few of these names, e.g. extensions/dune-alugrid!183 (merged) or dune-fem/dune-fem!683 (merged) but there are more. I wanted to open this issue to discuss possible solution.

Related issues discussed somewhere else

Possible solution

  • We add a naming convention for our targets, e.g., <dune_module>_<target_name>
  • We modify the utilities dune_add_test correspondingly to automatically prefix all test targets with the dune module name, maybe we export the generated target name in an output variable
  • We could add another utility dune_add_executable that does the same for executable targets