[CMake] Add a helper function to extract paths

Developing CMake code yourself you often need to access path variables like: What is the build directory of dune-grid? What is the cmake modules directory of dune-common? Unfortunately, there are two problems with that:

  • The extract method changes depending on whether you are currently configuring the module itself or whether you are configuring a downstream module.
  • Normal people tend to forget the naming schemes of the path variable.

This commit introduces a function with a documented interface that allows for querying dune module paths. You give it the name of the dune module, the name of the return variable and a path type. Currently implemented path types are CMAKE_MODULES and BUILD_DIR. More may be added as needed.

Merge request reports

Loading