Skip to content

Deprecate usage of dune_project cmake function outside of CMake project directories

Proposal

Deprecate usage of dune_project cmake function outside of CMake project directories

Reasoning

In the future, I would like to see a dune module that does not need dune_project()/finalize_dune_project() at all. All of these things can be achieved somehow else in a very compatible way.

  • All of the effects of dune_project() can be achieved at find_package(dune-common). The only question is what do we want to move there and what needs to be deprecated.
  • All of the effects of finalize_dune_project() can be triggered by a cmake deferred call cmake_language(DEFER CALL ) triggered by dune_add_library or find_package(dune-common) if a dune module file is found.

For this, we need to be sure that the effects of dune_project() and finalize_dune_project() are predictable with respect to a given directory. That is, the CMake project directory ${PROJECT_SOURCE_DIR}.

Backwards Compatibility

Most if not all projects already follow the practice of having a dune project exactly where cmake project is. Thus, most people won't even notice this issue. For those who rely on this feature, CMake now supports nested projects, so the situation is also easily solvable.

Merge request reports