How to increase the c++ standard for all dune modules? The cmake variable CMAKE_CXX_STANDARD is used for all targets in a cmake project as default c++ standard.This should be combined with a corresponding c++ standard used for all dune modules. But a call of target_compile_features( cxx_std_) on the target with name sets an arbitrary standard requirement for the code. Mixing c++ standards in dependent libraries is undefined behaviour, and thus not recommended. How to enforce in a downstream module a different (higher) c++-standard for a specific target than is set in dune-common?.How do downstream modules/libraries inherit the c++-standard requirement? Simply by linking against the dunecommon target.The c++-standard is not a global property / global compiler flag anymore. The dunecommon target-properties are only propagated, if a downstream target links against it. The change has an implication on other dune modules and targets. This has to be tested separately using individual feature tests. It might be, though, that not all c++-17 library feature are already implemented by the corresponding standard library. With this MR, the dunecommon library target gets the compile-feature cxx_std_17 that enforces at least c++-language standard 17 to be supported by the compiler. By using these, the highest required standard is passed to the compiler and there is not mixup with flags and standard requirements. The "cmake-way" of setting the c++-standard requirement is either a target property or a target feature. Sometimes the user needs a higher c++ standard than defined for dune-common, maybe just on a single target. DetailsĮnforcing a c++-standard is different between compilers, the flags might have different names or are not necessary at all. The cmake function dune_require_cxx_standard() is now deprecated. The cmake options CXX_MAX_STANDARD, CXX_MAX_SUPPORTED_STANDARD and DISABLE_CXX_VERSION_CHECK are removed. This requirement is propagated to all other modules by linking against dunecommon. Setting the minimal c++ standard in cmake is now done by a cmake feature-requirement cxx_std_17 on the dunecommon library target.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |