build: Add fmt subproject support

This makes it possible to build again without using the openbmc
container.

Change-Id: Ifa4c0ad2b1e070a0247480d4e0319e9a812046ab
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/meson.build b/src/meson.build
index a2c3758..8013bf5 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -4,6 +4,21 @@
 
 src_includes = include_directories('.')
 
+fmt_dep = dependency('fmt', required: false)
+if not fmt_dep.found()
+  fmt_opts = import('cmake').subproject_options()
+  fmt_opts.add_cmake_defines({
+    'CMAKE_POSITION_INDEPENDENT_CODE': 'ON',
+    'MASTER_PROJECT': 'OFF',
+  })
+  fmt_proj = import('cmake').subproject(
+    'fmt',
+    options: fmt_opts,
+    required: false)
+  assert(fmt_proj.found(), 'fmtlib is required')
+  fmt_dep = fmt_proj.dependency('fmt')
+endif
+
 executable(
   'ncsi-netlink',
   'argument.cpp',
@@ -12,7 +27,7 @@
   implicit_include_directories: false,
   include_directories: src_includes,
   dependencies: [
-    dependency('fmt'),
+    fmt_dep,
     dependency('libnl-3.0'),
     dependency('libnl-genl-3.0'),
     phosphor_dbus_interfaces_dep,
diff --git a/subprojects/fmt.wrap b/subprojects/fmt.wrap
new file mode 100644
index 0000000..6847ae5
--- /dev/null
+++ b/subprojects/fmt.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+url = https://github.com/fmtlib/fmt
+revision = HEAD