Check in CI that Meson and pkg-config offer the CMake options

tools/check_build_options/check_build_options.py takes the compile
definitions of the CMake target as the reference and checks that the
CMake pkg-config block, meson_options.txt (name and default), meson.build,
and the Meson section of the package manager docs have each option with
the same definition and condition. It runs as make check_build_options
in the ci_meson_install job, so a new CMake option cannot be forgotten
in the Meson build again.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-10-01 14:19:32 +02:00
parent 73b8a6a9c8
commit 4289a38275
6 changed files with 175 additions and 2 deletions
+3 -1
View File
@@ -267,7 +267,9 @@ ninja -C builddir
```
`meson_options.txt` defines the options, which mirror the CMake options that change the library's target (for example,
`-DDiagnostics=true`). Meson requires this file next to `meson.build`, so it is also part of `include.zip`.
`-DDiagnostics=true`). Meson requires this file next to `meson.build`, so it is also part of `include.zip`. `make check_build_options`
([`tools/check_build_options`](tools/check_build_options/README.md)) checks in CI that both files and the pkg-config files
stay in sync with the CMake options.
When installing, `meson.build` installs the headers, a pkg-config file, and the CMake package config files, so that
`find_package(nlohmann_json)` works. As Meson cannot generate `nlohmann_jsonTargets.cmake` itself, it is created from