Skip to content

Feature/improve cmake setup

Timo Koch requested to merge feature/improve-cmake-setup into master

What this MR does / why does DuMux need it:

This MR implements the dumux targets in a more explicit way to follow modern CMake practices (following this suggestion). In particular, it avoids relying on the dune_enable_all_packages magic, and instead communicates the dependencies explicitly.

  1. Create a DuMuX libraries explicitly with dune_add_library. This is analogous to CMake's add_library but it also integrates with the dune build system to automatically generate configuration file for downstream projects.
  2. Add source files to libraries with native CMake target_sources. This follows a regular CMake pattern instead of the outdated dune_library_add_sources from DUNE.
  3. Express target dependencies explicitly with target_link_libraries and dune_target_enable_all_packages instead of relying on the dune build system to link against everything.

The primary motivation for this MR is to address a new warning appearing in dune-common 2.11. However, similar to the core modules, this pattern also moves DuMuX towards a build system that may provide a CMake experience in downstream modules without the dune build system. In the future, when the dune build system is ready, people should ideally only consume the Dumux::Dumux target after finding the dumux CMake project without having anything to do with dune and its CMake.

Plan

  • Look to treat some of the dependencies in the same way as gridformat
  • Move external libs to a central place
  • Minimize DumuxMacros.cmake and move towards exporting dependencies & compile definitions via targets
Edited by Timo Koch

Merge request reports

Loading