nvmesensor: Introduce nvme-mi-mctp build feature
Allow MCTP support to be configured at build time.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I280337fce81a24c47bdb3b86279f2664ba80b380
diff --git a/src/meson.build b/src/meson.build
index 3475bd5..d2535e2 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -139,10 +139,16 @@
if get_option('nvme').enabled()
nvme_srcs = files('NVMeSensorMain.cpp', 'NVMeSensor.cpp')
nvme_srcs += files('NVMeBasicContext.cpp')
- nvme_srcs += files('NVMeMCTPContext.cpp')
- mctp = meson.get_compiler('cpp').find_library('libmctp')
- nvme_deps = [ default_deps, i2c, mctp, thresholds_dep, utils_dep, threads ]
+ nvme_deps = [ default_deps, i2c, thresholds_dep, utils_dep, threads ]
+
+ mi_mctp = get_option('nvme-mi-mctp')
+ if mi_mctp.enabled()
+ nvme_srcs += files('NVMeMCTPContext.cpp')
+ nvme_deps += meson.get_compiler('cpp').find_library('libmctp')
+ conf_data = configuration_data()
+ conf_data.set('HAVE_NVME_MI_MCTP', true)
+ endif
executable(
'nvmesensor',