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/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'