mirror of
https://github.com/nlohmann/json.git
synced 2026-10-01 20:20:32 +00:00
Install CMake package config files with Meson
A Meson installation only provided the headers and a pkg-config file, so consumers using find_package(nlohmann_json) could not find the library. Meson now also installs nlohmann_jsonConfig.cmake and nlohmann_jsonConfigVersion.cmake from the existing templates, plus a static nlohmann_jsonTargets.cmake that defines the header-only imported target with a relocatable include path. A new CI job installs with Meson and builds tests/cmake_import/project against the result. Closes #3885 Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -121,10 +121,15 @@ meson wrap install nlohmann_json
|
||||
Please see the Meson project for any issues regarding the packaging.
|
||||
|
||||
The provided `meson.build` can also be used as an alternative to CMake for installing `nlohmann_json` system-wide in
|
||||
which case a pkg-config file is installed. To use it, have your build system require the `nlohmann_json`
|
||||
pkg-config dependency. In Meson, it is preferred to use the
|
||||
[`dependency()`](https://mesonbuild.com/Reference-manual.html#dependency) object with a subproject fallback, rather than
|
||||
using the subproject directly.
|
||||
which case a pkg-config file and the CMake package config files are installed. To use it, have your build system require
|
||||
the `nlohmann_json` pkg-config dependency, or use [`find_package(nlohmann_json)`](cmake.md#external) in CMake. In Meson,
|
||||
it is preferred to use the [`dependency()`](https://mesonbuild.com/Reference-manual.html#dependency) object with a
|
||||
subproject fallback, rather than using the subproject directly.
|
||||
|
||||
!!! note
|
||||
|
||||
The `meson.build` does not expose the library's [CMake options](cmake.md#cmake-options), so a Meson installation
|
||||
always uses the library's default configuration.
|
||||
|
||||
??? example "Example: Wrap"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user