meson: adjust nlohmann-json dependency
- Simplify nlohmann-json dependency in meson.build.
- Use consistent dependency variable names (based on Meson style).
- Align wrap file name with meson wrapdb choice for the project.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I2e893fd8c300b36a16d704f2002bb966a6e52ce4
diff --git a/.gitignore b/.gitignore
index d5005aa..884d00c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -117,7 +117,7 @@
!/subprojects/packagefiles/
!/subprojects/boost.wrap
!/subprojects/googletest.wrap
-!/subprojects/nlohmann.wrap
+!/subprojects/nlohmann_json.wrap
!/subprojects/phosphor-logging.wrap
!/subprojects/sdbusplus.wrap
diff --git a/meson.build b/meson.build
index 49fd172..19d783e 100644
--- a/meson.build
+++ b/meson.build
@@ -29,19 +29,14 @@
boost_version = '>=1.79.0'
boost_modules = ['coroutine', 'context']
boost = dependency('boost',
- version: boost_version,
+ version: boost_version,
modules: boost_modules)
+nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
phosphor_logging = dependency('phosphor-logging')
sdbusplus = dependency('sdbusplus')
systemd = dependency('systemd')
-if cxx.has_header('nlohmann/json.hpp')
- nlohmann_json = declare_dependency()
-else
- nlohmann_json = dependency('nlohmann_json')
-endif
-
add_project_arguments(
'-DTELEMETRY_MAX_REPORTS=' + get_option('max-reports').to_string(),
'-DTELEMETRY_MAX_READING_PARAMS=' +
@@ -87,7 +82,7 @@
],
dependencies: [
boost,
- nlohmann_json,
+ nlohmann_json_dep,
sdbusplus,
phosphor_logging,
],
diff --git a/subprojects/nlohmann.wrap b/subprojects/nlohmann_json.wrap
similarity index 62%
rename from subprojects/nlohmann.wrap
rename to subprojects/nlohmann_json.wrap
index 477e844..3745380 100644
--- a/subprojects/nlohmann.wrap
+++ b/subprojects/nlohmann_json.wrap
@@ -1,6 +1,6 @@
[wrap-git]
-url = https://github.com/nlohmann/json
revision = HEAD
+url = https://github.com/nlohmann/json.git
[provide]
nlohmann_json = nlohmann_json_dep
diff --git a/tests/meson.build b/tests/meson.build
index 9666a03..4dc883f 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -64,7 +64,7 @@
boost,
gmock_dep,
gtest_dep,
- nlohmann_json,
+ nlohmann_json_dep,
phosphor_logging,
sdbusplus,
],