meson: refactor cli11 dependency
cli11 has added support for being a meson subproject, so it can be
detected like any other dependency. Ensure it is used in system mode
(-isystem...), to help static analysis tools which make use of that.
Tested by building and running the unit tests using the cli11
subproject.
Change-Id: I8e3f4959a645eda34e995e736e1a05729fbc27f9
Signed-off-by: Brad Bishop <bradbish@qti.qualcomm.com>
diff --git a/meson.build b/meson.build
index 7c4336e..58c4984 100644
--- a/meson.build
+++ b/meson.build
@@ -13,13 +13,13 @@
version: '1.0',
)
-cxx = meson.get_compiler('cpp')
-
-if cxx.has_header('CLI/CLI.hpp')
- cli11_dep = declare_dependency()
-else
- cli11_dep = dependency('cli11')
+cli11 = dependency('CLI11', required: false, include_type: 'system')
+if not cli11.found()
+ cli11_proj = subproject('cli11', required: true)
+ cli11 = cli11_proj.get_variable('CLI11_dep')
+ cli11 = cli11.as_system('system')
endif
+
phosphor_logging = dependency('phosphor-logging')
phosphor_dbus_interfaces = dependency('phosphor-dbus-interfaces')
sdbusplus = dependency('sdbusplus')
@@ -160,7 +160,7 @@
executable(
'phosphor-unit-failure-monitor',
['fail-monitor/main.cpp', 'fail-monitor/monitor.cpp'],
- dependencies: [cli11_dep, phosphor_logging],
+ dependencies: [cli11, phosphor_logging],
install: true,
)
endif