build: use allowed over enabled
Meson feature options are typically in a tri-state of enabled, disabled,
or auto. The enabled and disabled functions on an option (from
`get_option`) no longer return true for auto features. Instead, the
expectation is to use `allowed()` which is true for both enabled and auto.
Switch all uses of `enabled` to `allowed`.
Change-Id: I882edd53856df38c8292bc3313b9342b2b1ceddd
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/service_files/meson.build b/service_files/meson.build
index 5f5b78c..cfa3297 100644
--- a/service_files/meson.build
+++ b/service_files/meson.build
@@ -13,7 +13,7 @@
]
foreach tuple : unit_files
- if get_option(tuple[0]).enabled()
+ if get_option(tuple[0]).allowed()
configure_file(
copy: true,
input: tuple[1],
diff --git a/src/meson.build b/src/meson.build
index 03310b7..f0403ab 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,6 +1,6 @@
conf_data = configuration_data()
-conf_data.set10('VALIDATION_UNSECURE_FEATURE', get_option('validate-unsecure-feature').enabled())
-conf_data.set10('INSECURE_UNRESTRICTED_SENSOR_OVERRIDE', get_option('insecure-sensor-override').enabled())
+conf_data.set10('VALIDATION_UNSECURE_FEATURE', get_option('validate-unsecure-feature').allowed())
+conf_data.set10('INSECURE_UNRESTRICTED_SENSOR_OVERRIDE', get_option('insecure-sensor-override').allowed())
configure_file(input: 'dbus-sensor_config.h.in',
output: 'dbus-sensor_config.h',
configuration: conf_data)
@@ -60,11 +60,11 @@
peci_incdirs = ['../include']
endif
-if get_option('intel-cpu').enabled()
+if get_option('intel-cpu').allowed()
peci_dep = dependency('libpeci', required : true)
endif
-if get_option('adc').enabled()
+if get_option('adc').allowed()
executable(
'adcsensor',
'ADCSensor.cpp',
@@ -79,7 +79,7 @@
)
endif
-if get_option('intel-cpu').enabled()
+if get_option('intel-cpu').allowed()
executable(
'intelcpusensor',
'IntelCPUSensorMain.cpp',
@@ -96,7 +96,7 @@
)
endif
-if get_option('exit-air').enabled()
+if get_option('exit-air').allowed()
executable(
'exitairtempsensor',
'ExitAirTempSensor.cpp',
@@ -109,7 +109,7 @@
)
endif
-if get_option('fan').enabled()
+if get_option('fan').allowed()
executable(
'fansensor',
'FanMain.cpp',
@@ -125,7 +125,7 @@
)
endif
-if get_option('hwmon-temp').enabled()
+if get_option('hwmon-temp').allowed()
executable(
'hwmontempsensor',
'HwmonTempMain.cpp',
@@ -140,7 +140,7 @@
)
endif
-if get_option('intrusion').enabled()
+if get_option('intrusion').allowed()
executable(
'intrusionsensor',
'ChassisIntrusionSensor.cpp',
@@ -155,7 +155,7 @@
)
endif
-if get_option('ipmb').enabled()
+if get_option('ipmb').allowed()
executable(
'ipmbsensor',
'IpmbSensor.cpp',
@@ -169,7 +169,7 @@
)
endif
-if get_option('mcu').enabled()
+if get_option('mcu').allowed()
executable(
'mcutempsensor',
'MCUTempSensor.cpp',
@@ -183,7 +183,7 @@
)
endif
-if get_option('nvme').enabled()
+if get_option('nvme').allowed()
nvme_srcs = files('NVMeSensorMain.cpp', 'NVMeSensor.cpp')
nvme_srcs += files('NVMeBasicContext.cpp')
@@ -197,7 +197,7 @@
)
endif
-if get_option('psu').enabled()
+if get_option('psu').allowed()
executable(
'psusensor',
'PSUEvent.cpp',
@@ -214,7 +214,7 @@
)
endif
-if get_option('external').enabled()
+if get_option('external').allowed()
executable(
'externalsensor',
'ExternalSensor.cpp',
diff --git a/tests/meson.build b/tests/meson.build
index 28915d6..3582c07 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -13,7 +13,7 @@
gmock_dep = gtest_proj.dependency('gmock')
else
assert(
- not get_option('tests').enabled(),
+ not get_option('tests').allowed(),
'Googletest is required if tests are enabled'
)
endif