It seems like OPM support for Dune 2.3 is going to be removed sooner
rather than later. Also, all relevant distributions which I'm aware of
seem to ship at least Dune-2.4 packages.
note that this patch switches to Dune 2.4.1 instead of the latest Dune
2.4 release (i.e., 2.4.2) because travis seems to block downloads from
sites it does not know -- in this case dune-project.org -- and the
Dune github mirrors seem to have been abandoned a few months ago and
thus do not feature dune 2.4.2.
Previously, we checked for header CpGrid.hpp which finally
tried to include the non-existent generic geometry headers
as the checks for dune-geometry versions do not work during
a CMake run.
With this patch we search for the header GlobalIdMapper.hpp which
does not use any version checks and therefore works for every DUNE
version.
These take precendence over the package registry where we have no control
on which entry will be used. The registry is only the last resort.
On some Linux version the most recently created package registry key will
be used. Please not that an entry is only created for a build try that is
not already in the registry. If there is already key, then not even the
modification date of the key will be updated. This default behaviour might
lead to strange mixes of build configurations.
CONFIG mode is usually a fallback when Find* modules are not found, but
opm-parser is now mainly meant to be used with config mode, so it's the
first thing being tried. If that fails, continue with the old logic.
Some legacy requires HAVE_ERT being set somewhere, so this logic is
injected here.
Previously, this failed if one dependency was a static library compiled
without -fPIC. This is is the case for library libsuitesparseconfig on
Debian which has no dynamic alternative. The error messages read e.g.
```
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libsuitesparseconfig.a(SuiteSparse_config.o): relocation R_X86_64_PC32 against undefined symbol `malloc@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
```
With this patch we change the target_link_libraries call when using
BUILD_SHARED_LIBS=ON. We only pass the dynamic libraries as PUBLIC such
that they will get linked to the library. The static ones are passed as
INTERFACE libraries. This means that they will be automatically linked
to executables which link to the main library. Currently this transitive
linking will only work in the same module as we do not correctly export
libraries. But our build system explicitly links the others ones anyway.