Add option to override or ignore DUNE_HAVE_CXX_OPTIONAL and associated check
The implementation of
std::optional shipped with Apple Clang v10 is incompatible to the DUNE
Std::optional implementation. This only becomes apparent when trying to compile dune-functions, see staging/dune-functions#41 (closed). The actual error is apparently caused by restrictions of the value type inserted into
The general check for
std::optional succeeds, therefore the CMake variable and CPP macro
DUNE_HAVE_CXX_OPTIONAL is set. This, in turn, disables the DUNE implementation in
Current workaround on Mac
#ifdef DUNE_HAVE_CXX_OPTIONAL blocks in
dune/common/std/optional.hh. This is not portable, of course.
-DDUNE_HAVE_CXX_OPTIONAL=OFF as CMake flag.
I have two ideas how to solve this:
Have a CMake flag that disables, or overrides the result of, the check for
-DDUNE_HAVE_CXX_OPTIONAL=OFFoverrides the test result.
CMAKE_CXX_COMPILER_IDis equal to
AppleClangand then always disable the check.
Is there a general policy for such cases? If not, I can come up with a simple MR.