Skip to content
Takatoshi Kondo edited this page Aug 24, 2021 · 12 revisions

Configuration Macros

MQTT_USE_TLS (since v7.0.0)

If you define MQTT_USE_TLS macro, mqtt_cpp enables TLS features. In order to use TLS features, you need to prepare OpenSSL.

MQTT_NO_TLS (until v6.x)

If you define MQTT_NO_TLS macro, mqtt_cpp disables TLS features. So you don't need to prepare OpenSSL.

MQTT_USE_WS

If you define MQTT_USE_WS macro, mqtt_cpp supports WebSocket using Beast.

Update: Since the Boost Libraries version 1.66.0, it contains the Beast.

MQTT_USE_STR_CHECK

If you define MQTT_USE_STR_CHECK, mqtt_cpp checks UTF8 string validation at the place MQTT spec required.

MQTT_USE_LOG

If you define MQTT_USE_LOG, then mqtt_cpp outputs log messages using Boost.Log.

MQTT_STD_OPTIONAL

If you define MQTT_STD_OPTIONAL macro, mqtt_cpp use std::optional instead of boost::optional.

MQTT_STD_VARIANT

If you define MQTT_STD_VARIANT macro, mqtt_cpp use std::variant instead of boost::variant.

MQTT_STD_STRING_VIEW

If you define MQTT_STD_STRING_VIEW macro, mqtt_cpp use std::string_view instead of boost::string_view.

Note: If you don't define MQTT_STD_STRING_VIEW and Boost version is less than 1.61.0, then boost::string_ref is used.

MQTT_NS

If you define MQTT_NS macro with a string, the string is used as the namespace of mqtt_cpp. If you don't define it, then mqtt is used as the namespace of mqtt_cpp.

MQTT_USE_DEPRECATED

mqtt_cpp outputs warning message if you use deprecated functions. If you define MQTT_USE_DEPRECATED, then warning message is suppressed.
Note that deprecated functions will be removed in the future release. So I recommend that use MQTT_USE_DEPRECATED as temporary.

Build control cmake options

MQTT_BUILD_EXAMPLES

If set it to ON (default), then build examples.

MQTT_BUILD_TESTS

If set it to ON (default), then build tests.