Skip to content

Change how optional dependencies are handled in downstream projects

Marco Clemencic requested to merge clemenci/Gaudi:split-pub-priv-deps into master

The rationale of the original implementation of GaudiDependencies.cmake was that an optional dependency enabled at build time becomes a required dependency when Gaudi is used in downstream projects.

In CMake optional usually means that not finding the dependency is not a problem and we can build anyway, while for Gaudi we decided that optional means that the dependency can be turned off (but if it is on and we do not find it is a fatal error).

The original approach is not always correct as we have

  • required dependencies (like ROOT or Boost)
  • optional dependencies that are required downstream if enabled (AIDA)
  • optional dependencies that are not required downstream (IntelAmplifier, gpertools, ...)
  • optional build time dependencies (CppUnit, Doxygen)

(I ignore required build time dependencies as I do not have any in Gaudi)

As we are using CMake FeatureSummary a better logic is to consider REQUIRED everything we look for at build time (given that when we turn off a dependency we do not look for it), but ignore some dependencies in downstream projects (like CppUnit and Doxygen), while demoting others to RECOMMENDED (like IntelAmplifier and gperftools). Like this, we still do the lookup downstream for runtime dependencies that we may decide not use when we run the application (like the profilers).

An even better approach would be to reorganize the dependencies in features and report about the enabled and disabled features, but I do not have the time for it at the moment.

Edited by Marco Clemencic

Merge request reports