meson: adjust nlohmann-json dependency

- Simplify dependency logic in meson.build.
- Use consistent dependency variable as style recommended by Meson.
- Use json wrap file matching the meson wrapdb.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I8b6e14c03657a2017ab2c89ad98d5c460d3b7917
diff --git a/meson.build b/meson.build
index 782ac04..26ffb74 100644
--- a/meson.build
+++ b/meson.build
@@ -89,6 +89,7 @@
     add_project_arguments('-DENABLE_WARM_REBOOT',language:'cpp')
 endif
 
+nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
 sdbusplus = dependency('sdbusplus')
 sdeventplus = dependency('sdeventplus')
 phosphorlogging = dependency('phosphor-logging')
@@ -96,18 +97,6 @@
 libgpiod = dependency('libgpiod', version : '>=1.4.1')
 fmt = dependency('fmt')
 
-if cpp.has_header('nlohmann/json.hpp')
-    nlohmann_json = declare_dependency()
-else
-    subproject('nlohmann-json')
-    nlohmann_json = declare_dependency(
-        include_directories: [
-            'subprojects/nlohmann-json/single_include',
-            'subprojects/nlohmann-json/single_include/nlohmann',
-        ]
-    )
-endif
-
 if cpp.has_header('CLI/CLI.hpp')
     CLI11 = declare_dependency()
 else
@@ -173,7 +162,7 @@
                 cereal,
                 fmt,
                 libgpiod,
-                nlohmann_json,
+                nlohmann_json_dep,
                 phosphordbusinterfaces,
                 phosphorlogging,
                 sdbusplus,
@@ -237,7 +226,7 @@
             dependencies: [
                 CLI11,
                 libgpiod,
-                nlohmann_json,
+                nlohmann_json_dep,
                 phosphorlogging,
                 sdbusplus,
                 sdeventplus,
@@ -322,7 +311,7 @@
           'systemd_target_parser.cpp',
           dependencies: [
               gtest,
-              nlohmann_json,
+              nlohmann_json_dep,
           ],
           implicit_include_directories: true,
           include_directories: '../'
@@ -338,7 +327,7 @@
           dependencies: [
               gtest,
               libgpiod,
-              nlohmann_json,
+              nlohmann_json_dep,
               phosphorlogging,
               sdbusplus,
               sdeventplus,
diff --git a/subprojects/nlohmann-json.wrap b/subprojects/nlohmann_json.wrap
similarity index 61%
rename from subprojects/nlohmann-json.wrap
rename to subprojects/nlohmann_json.wrap
index 9096612..3745380 100644
--- a/subprojects/nlohmann-json.wrap
+++ b/subprojects/nlohmann_json.wrap
@@ -1,3 +1,6 @@
 [wrap-git]
-url = https://github.com/nlohmann/json.git
 revision = HEAD
+url = https://github.com/nlohmann/json.git
+
+[provide]
+nlohmann_json = nlohmann_json_dep