build: Move boost dependency into example

This simplifies the build check by using disabler objects, and will
remove the need to do the dependency check if we disable examples. They
will be disabled for subprojects.

Change-Id: I50a4166b98fbb73ae10fa83174c4e6fccdaab740
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/example/meson.build b/example/meson.build
index 9b1cef4..5cd906a 100644
--- a/example/meson.build
+++ b/example/meson.build
@@ -4,19 +4,25 @@
     dependencies: sdbusplus_dep,
 )
 
-if boost_dep.found()
-    executable(
-        'asio-example',
-        'asio-example.cpp',
-        cpp_args: [
-            '-DBOOST_ALL_NO_LIB',
-            '-DBOOST_SYSTEM_NO_DEPRECATED',
-            '-DBOOST_ERROR_CODE_HEADER_ONLY',
-            '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
-        ],
-        dependencies: [ boost_dep, pthread_dep, sdbusplus_dep ],
-    )
-endif
+boost_dep = dependency(
+    'boost',
+    disabler: true,
+    required: false,
+    modules: [ 'coroutine' ],
+)
+
+executable(
+    'asio-example',
+    'asio-example.cpp',
+    cpp_args: [
+        '-DBOOST_ASIO_DISABLE_THREADS',
+        '-DBOOST_ALL_NO_LIB',
+        '-DBOOST_SYSTEM_NO_DEPRECATED',
+        '-DBOOST_ERROR_CODE_HEADER_ONLY',
+        '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
+    ],
+    dependencies: [ boost_dep, sdbusplus_dep ],
+)
 
 calc_buildroot = meson.current_build_dir()
 calc_files = files(
diff --git a/meson.build b/meson.build
index 678b960..2681be7 100644
--- a/meson.build
+++ b/meson.build
@@ -33,11 +33,6 @@
 
 subdir('tools')
 
-boost_dep = dependency(
-    'boost',
-    required: false,
-    modules: [ 'coroutine' ],
-)
 pthread_dep = dependency('threads')
 
 subdir('example')