[cmake] Only require modules in 'Depends:' with new policy

Add a function dune_mark_module_as_required_dependency that allows to promote any suggested dune module dependencies to required module dependencies. This can be used in case a module becomes a hard requirement once found.

This was the default behaviour before this change (and is the behaviour with the policy set to OLD) but this behaviour leads to unnecessary dependencies imposed on downstream projects in case a dune module dependency is only required internally (e.g. for testing) and is otherwise optional (e.g. headers are guarded by #if HAVE_DUNE_*).

Introduce a policy DP_SUGGESTED_MODULE_DEPENDENCIES_REQUIRED_DOWNSTREAM that enables the new behaviour.

Edited by Timo Koch

Merge request reports

Loading