unit-test: add meson version check for C++23
We can start using C++23 in Meson, but it requires meson 1.1.1 or
later. Add the meson_version check in unit-test just like we've
done in the past for C++20.
Tested:
Changed sdbusplus to only have 'cpp_std=c++23' while using older
meson_version and experienced the expected exception.
```
Exception: C++23 support requires specifying in meson.build: meson_version: '>=1.1.1'
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I3d355f5176fb1874b7301ab995e96f22dbd6b429
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index 4221d0f..1e8eef8 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -1114,6 +1114,19 @@
+ "meson_version: '>=0.57'"
)
+ # C++23 requires at least Meson 1.1.1 but Meson itself doesn't
+ # identify this. Add to our unit-test checks so that we don't
+ # get a meson.build missing this.
+ pattern = r"'cpp_std=c\+\+23'"
+ for match in re.finditer(pattern, build_contents):
+ if not meson_version or not meson_version_compare(
+ meson_version, ">=1.1.1"
+ ):
+ raise Exception(
+ "C++23 support requires specifying in meson.build: "
+ + "meson_version: '>=1.1.1'"
+ )
+
if "get_variable(" in build_contents:
if not meson_version or not meson_version_compare(
meson_version, ">=0.58"