meson: Build C++ tests for the currently supported C++ standard versions

We've various macros definitions that are depending using C++ features
that may not work in all the standard versions, so recompile the cxx
tests that we have in all the ones we want to support.
This commit is contained in:
Marco Trevisan (Treviño)
2022-09-13 18:26:40 +02:00
parent a20a36b26f
commit 1cbe7a6734
5 changed files with 61 additions and 0 deletions

View File

@@ -13,6 +13,14 @@ cc = meson.get_compiler('c')
have_cxx = add_languages('cpp', native: false, required: get_option('oss_fuzz').enabled())
if have_cxx
cxx = meson.get_compiler('cpp')
cxx_standards = {}
foreach std : ['98', '03', '11', '14', '17', '20', '2b', 'latest']
arg = (cxx.get_id() == 'msvc' ? '/std:' : '-std=') + 'c++' + std
if cxx.has_argument(arg)
cxx_standards += { std: arg }
endif
endforeach
endif
cc_can_run = meson.can_run_host_binaries()