Skip to content

Move dunecommon target to the root CMakeLists file

Simon Praetorius requested to merge issue/root-library-target into master

Summary

Introduce the dunecommon library target directly in the root CMakeLists.txt file.

The pattern I have introduced here is something that I think should be the default:

  1. Create a module library target in the root CMakeLists.txt by dune_add_library(<target> [INTERFACE]) where INTERFACE should be used for header-only libraries
  2. If there are sources to compile, add these to the library target in the corresponding dune/foo/sub/ directories, using target_sources(<target> PRIVATE <sources>...)
  3. In case you want to set additional flags, or link against additional libraries, either do this in the CMakeLists.txt file you had in the lib/ subdirectory, or (better) directly in the root CMakeLists.txt file so that all target properties can be found in one spot.

It will be applied step by step also in other modules.

Merge request reports