Fix fmt subproject handling

Without this standalone builds were failing with:

meson.build:70:6: ERROR: Dependency 'fmt' is required but not found.

Change-Id: Ic85937bdfb5a6c837df844e2eb26331a9b6eb755
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/meson.build b/meson.build
index 7f7ed0b..bad2745 100644
--- a/meson.build
+++ b/meson.build
@@ -67,7 +67,18 @@
 pthread = dependency('threads')
 stdplus = dependency('stdplus')
 boost = dependency('boost')
-fmt = dependency('fmt')
+fmt = dependency('fmt', required: false)
+if not fmt.found()
+  fmt_proj = import('cmake').subproject(
+    'fmt',
+    cmake_options: [
+      '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
+      '-DMASTER_PROJECT=OFF'
+    ],
+    required: false)
+  assert(fmt_proj.found(), 'fmtlib is required')
+  fmt = fmt_proj.dependency('fmt')
+endif
 libgpiodcxx = dependency('libgpiodcxx',
     default_options: ['bindings=cxx'])