meson: nlohmann/json has a meson build
Exploit the usual configuration available for subprojects that support
meson directly.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ifef98dc70a24f41df1b199fcbf28fe034a5526bc
diff --git a/meson.build b/meson.build
index dea5ea8..5264985 100644
--- a/meson.build
+++ b/meson.build
@@ -33,18 +33,10 @@
if get_option('fru-device')
i2c = cpp.find_library('i2c')
endif
-if cpp.has_header('nlohmann/json.hpp')
- nlohmann_json = declare_dependency()
-else
- subproject('nlohmann', required: false)
- nlohmann_json = declare_dependency(
- include_directories: [
- 'subprojects/nlohmann/single_include',
- 'subprojects/nlohmann/single_include/nlohmann',
- ]
- )
- nlohmann_json = nlohmann_json.as_system('system')
-endif
+
+nlohmann_json_dep = dependency('nlohmann_json',
+ fallback: [ 'nlohmann_json', 'nlohmann_json_dep'])
+
sdbusplus = dependency('sdbusplus', required: false)
if not sdbusplus.found()
sdbusplus_proj = subproject('sdbusplus', required: true)
@@ -217,7 +209,7 @@
dependencies: [
boost,
gtest,
- nlohmann_json,
+ nlohmann_json_dep,
sdbusplus,
valijson,
],