build: fix nlohmann-json dependency

Previously the json dependency was only added when `json-control` or
`json-config` options were enabled, but there is now base code that
utilizes nlohmann-json directly (such as logger.hpp).  Add the
dependency at the top level.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ia92e54f9bd4812af0977bcfa5479f093f7bdbc67
diff --git a/control/meson.build b/control/meson.build
index 447f29f..b152e96 100644
--- a/control/meson.build
+++ b/control/meson.build
@@ -102,7 +102,8 @@
       dependencies: [
           cli11_dep,
           fmt_dep,
-          sdbusplus_dep
+          json_dep,
+          sdbusplus_dep,
       ],
   include_directories: phosphor_fan_control_include_directories,
   install: true
diff --git a/meson.build b/meson.build
index 6ddc52e..a0bbecd 100644
--- a/meson.build
+++ b/meson.build
@@ -46,8 +46,13 @@
     cereal_dep = cereal_proj.dependency('cereal')
 endif
 
+if cpp.has_header('nlohmann/json.hpp')
+    json_dep = declare_dependency()
+else
+    json_dep = dependency('nlohmann_json')
+endif
+
 fmt_dep = dependency('fmt')
-json_dep = declare_dependency()
 
 phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
 phosphor_logging_dep = dependency('phosphor-logging')
@@ -125,9 +130,6 @@
     endif
     conf.set('MONITOR_USE_JSON', '')
 
-    if not cpp.has_header('nlohmann/json.hpp')
-        json_dep = dependency('nlohmann_json')
-    endif
     conf_type = 'json'
 else
     conf_type = 'yaml'
diff --git a/presence/meson.build b/presence/meson.build
index d3028d6..7237565 100644
--- a/presence/meson.build
+++ b/presence/meson.build
@@ -19,11 +19,12 @@
 ]
 
 deps=[
+    json_dep,
     libevdev_dep,
     phosphor_dbus_interfaces_dep,
     phosphor_logging_dep,
     sdbusplus_dep,
-    sdeventplus_dep
+    sdeventplus_dep,
 ]
 
 # Only needed for YAML config