Add ENABLE_<package> compile definitions for optional packages
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:
- Is the package found in the system?
- 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)