[Dune] Enforcement of c++ standard

Oliver Sander oliver.sander at tu-dresden.de
Mon Mar 27 09:23:34 CEST 2023


Thanks, Simon!

Can you please add this helpful information to the build system documentation
on dune-project.org?  Thank!

Oliver

On 26.03.23 20:31, Simon Praetorius wrote:
> Dear dune community,
> 
> The dune buildsystem is evolving. We try to remove more and more dune-specific cmake functions move towards a more cmake-standard implementation. This comes with some changes. The recent change addresses the enforcement of a different c++ standard in your dune modules. While in dune core modules we currently required c++17, this might be different in your own modules. The old variable CXX_MAX_STANDARD, CXX_MAX_SUPPORTED_STANDARD, DISABLE_CXX_VERSION_CHECK, and the function dune_require_cxx_standard() are either deprecated or removed directly. If you want to enforce a specific c++ standard > c++17 in your downstream-/user-module you have two choices
> 
> 1. Set the required standard as a target feature to your module-library target:
> 
>      target_compile_features(<target> PUBLIC cxx_std_[17|20|...])
> 
>    If this property is PUBLIC, it is exported and is required for all dependent modules.
> 
> 2. Change your global c++ standard by setting CMAKE_CXX_STANDARD=[17|20|...], e.g. in your opts file or some other global configuration.
> 
> The dune-common target has as new target requirement cxx_std_17. This property is exported and automatically enforced in all targets linking against dune-common. It is not recommended to manually set the CXX_FLAGS "-std=c++...". This cannot interact with any globally or locally enforced standard requirements. So, prefer the local target feature or the global CMAKE_CXX_STANDARD variable.
> 
> Best regards,
> Simon
> 
> 
> _______________________________________________
> Dune mailing list
> Dune at lists.dune-project.org
> https://lists.dune-project.org/mailman/listinfo/dune
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5813 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20230327/5a34f49b/attachment.bin>


More information about the Dune mailing list