Skip to content
Snippets Groups Projects

Add ENABLE_<package> compile definitions for optional packages

Merged Simon Praetorius requested to merge feature/enable-optional-packages into master
1 unresolved thread

Summary

Optional (external) packages are not linked into a module library directly, but might be linked later using cmake functions add_dune_<package>_flags or similar. In order to detect whether a package can be used, we thus have to do two checks:

  1. Is the package found in the system?
  2. Has the user linked the library?

The first check is done by cmake. If a find_package(<package>) is called, a corresponding <package>_FOUND variable is set. We additionally set HAVE_<package> in cmake and introduce a conditional define in the config.h file. But finding the package does not mean it is linked against a target. This can be done (for optional packages) manually, by calling the add_dune_<package>_flags macro. Unfortunately, we have no way of knowing whether a library will be linked. Thus we need to communicate this to the target using a compile flag, called ENABLE_<package>. The config.h then defines

#define HAVE_<package> ENABLE_<package>

With this MR, I introduce these missing ENABLE_<package> compile flags to some optional packages.

Related Issue

issue #252 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 36 36 if(MPI_C_FOUND)
    37 37 foreach(target ${targets})
    38 38 target_link_libraries(${target} PUBLIC MPI::MPI_C)
    39 target_compile_definitions(${target} PUBLIC "ENABLE_MPI=1")
  • added 1 commit

    • 115e3055 - Add ENABLE_<package> compile definitions for optional packages

    Compare with previous version

  • added 1 commit

    • efb613f3 - Add ENABLE_<package> compile definitions for optional packages

    Compare with previous version

  • mentioned in commit d5192b28

  • mentioned in merge request dune-istl!511 (closed)

  • mentioned in merge request dune-istl!509 (merged)

  • Please register or sign in to reply
    Loading