[Dune] Enforcement of c++ standard

Simon Praetorius simon.praetorius at tu-dresden.de
Sun Mar 26 20:31:12 CEST 2023


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

-- 
Dr. Simon Praetorius
Technische Universität Dresden
Institute of Scientific Computing
phone: +49 351 463-34432
mail: simon.praetorius at tu-dresden.de
web: https://tu-dresden.de/mn/math/wir/das-institut/beschaeftigte/simon-praetorius

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5785 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20230326/4c139cb0/attachment.bin>


More information about the Dune mailing list