[Dune] Enforcement of c++ standard

Christoph Grüninger foss at grueninger.de
Tue Mar 28 21:15:33 CEST 2023


Hi Oliver,
the most important parts (not about the transition) is part of our build 
system documentation:
> https://www.dune-project.org/sphinx/content/sphinx/core/dune-common.html#how-to-set-the-c-standard

Bye
Christoph


Am 27.03.23 um 09:23 schrieb Oliver Sander:
> 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
> 
> _______________________________________________
> Dune mailing list
> Dune at lists.dune-project.org
> https://lists.dune-project.org/mailman/listinfo/dune

-- 
L'enjeu est de bâtir la France de nos enfants,
pas de ressasser la France de notre enfance.
                        [Emmanuel Macron, 2022]



More information about the Dune mailing list