New CMake Build-System
While the current dune build system does its job, it is outdated, hard to maintain and extend, and complicated to use. In #199 (closed) a general discussion about a revision of the cmake build system is going on and there is a general consensus in updating the current system. The proposal for a new cmake build-system can be found in https://gitlab.dune-project.org/simon.praetorius/dune-cmake/-/wikis/Proposal-for-a-new-Dune-Build-System.
This Milestone intends to provide a roadmap to reach the new build-system in small steps that can be reviewed individually. In a proof-of-concept it was shown that module-wise transition is possible, see https://gitlab.dune-project.org/simon.praetorius/dune-cmake/issues/12. So, the plan is to start with dune-common and to provide templates for the transition of the other dune-modules.
The general steps necessary for a transition of one module to the new cmake system are as follows:
-
Update and cleanup the FindModules, by providing imported targets. These modules should follow the general cmake developer guideline and the examples in It's Time To Do CMake Right. If possible, FindModules should be replaced by ConfigFiles provided by the packages itself. -
Update the AddXYZFlags.cmake
files to use these new library targets. (hopefully, these can be removed at the end) -
Replace the compile features detection by https://gitlab.dune-project.org/simon.praetorius/dune-cmake/-/merge_requests/19 or something similar. -
Move find_package
fromDuneXYZMacros.cmake
todune-xyz-config.cmake.in
in form offind_dependency
-
Replace the global-property based configuration system by a target based configuration system
Steps 1 and 2 can probably be done with little discussion. Those steps should be fully compatible to the current build system. Steps 3 and 4 are more involved changes and need to be tested thoroughly. For step 4 we may provide a template or examples. The final step 5 will be a big one and will be broken down into smaller sub-steps.
How the target-based cmake could look like is discussion in the https://gitlab.dune-project.org/simon.praetorius/dune-cmake repository that also acts as a template for the interaction of dune modules in the new build system.