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: I410cc14ca426b1c4c26600f6a72a47aa4d944570
diff --git a/meson.build b/meson.build
index 4fb8877..981f6dc 100644
--- a/meson.build
+++ b/meson.build
@@ -32,18 +32,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)
@@ -183,7 +175,7 @@
             dependencies: [
                 boost,
                 gtest,
-                nlohmann_json,
+                nlohmann_json_dep,
                 sdbusplus,
                 valijson,
             ],
diff --git a/src/meson.build b/src/meson.build
index 8a9811b..1a445b3 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -8,7 +8,7 @@
     cpp_args: cpp_args + ['-DBOOST_ASIO_DISABLE_THREADS'],
     dependencies: [
         boost,
-        nlohmann_json,
+        nlohmann_json_dep,
         sdbusplus,
         valijson,
     ],
@@ -31,7 +31,7 @@
         dependencies: [
             boost,
             i2c,
-            nlohmann_json,
+            nlohmann_json_dep,
             sdbusplus,
             threads,
             valijson,
diff --git a/subprojects/nlohmann.wrap b/subprojects/nlohmann_json.wrap
similarity index 100%
rename from subprojects/nlohmann.wrap
rename to subprojects/nlohmann_json.wrap