meson: Add missing CLI11 check and subproject support
Change-Id: I86b9116a489e61642ee27e3dbee2fcbc267d6bca
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/meson.build b/meson.build
index e25a727..113814f 100644
--- a/meson.build
+++ b/meson.build
@@ -10,7 +10,22 @@
watchdog_headers = include_directories('.')
+# CLI11 might not have a pkg-config. It is header only so just make
+# sure we can access the needed symbols from the header.
+cli11_dep = dependency('cli11', required: false)
+has_cli11 = meson.get_compiler('cpp').has_header_symbol(
+ 'CLI/CLI.hpp',
+ 'CLI::App',
+ dependencies: cli11_dep,
+ required: false)
+if not has_cli11
+ cli11_proj = subproject('cli11', required: false)
+ assert(cli11_proj.found(), 'CLI11 is required')
+ cli11_dep = cli11_proj.get_variable('CLI11_dep')
+endif
+
watchdog_deps = [
+ cli11_dep,
dependency('phosphor-dbus-interfaces'),
dependency('phosphor-logging'),
dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']),
diff --git a/subprojects/cli11.wrap b/subprojects/cli11.wrap
new file mode 100644
index 0000000..407409c
--- /dev/null
+++ b/subprojects/cli11.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+url = https://github.com/CLIUtils/CLI11
+revision = HEAD