From e832bf711027206a08aaffb2a15b85d91e1619bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Kosobucki?= Date: Mon, 17 Feb 2025 22:26:05 +0100 Subject: [PATCH] Don't leak mosquitto headers We only use mosquitto types via pointers so we don't need full mosquitto headers to be included in our exported headers. This will make the life of users easier. We'll have only link time dependency. Co-Authored-By: Marco Thaller --- src/KDMqtt/mqtt.cpp | 1 + src/KDMqtt/mqtt.h | 5 ++++- tests/auto/mqtt/CMakeLists.txt | 3 ++- tests/auto/mqtt/tst_mqtt.cpp | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/KDMqtt/mqtt.cpp b/src/KDMqtt/mqtt.cpp index 23e1e976..628d9cd0 100644 --- a/src/KDMqtt/mqtt.cpp +++ b/src/KDMqtt/mqtt.cpp @@ -9,6 +9,7 @@ Contact KDAB at for commercial licensing options. */ #include "mqtt.h" +#include "mosquitto_wrapper.h" #include #include diff --git a/src/KDMqtt/mqtt.h b/src/KDMqtt/mqtt.h index f5d2b650..2a9b1372 100644 --- a/src/KDMqtt/mqtt.h +++ b/src/KDMqtt/mqtt.h @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -28,12 +27,16 @@ using namespace KDFoundation; using namespace KDUtils; +struct mosquitto_message; + namespace KDMqtt { constexpr int c_defaultPort = 1883; constexpr std::chrono::duration c_defaultKeepAlive = std::chrono::minutes(1); class IMqttClient; +class MosquittoLib; +class MosquittoClient; /* * Class: IMqttManager diff --git a/tests/auto/mqtt/CMakeLists.txt b/tests/auto/mqtt/CMakeLists.txt index 7bb882ed..9b5294c1 100644 --- a/tests/auto/mqtt/CMakeLists.txt +++ b/tests/auto/mqtt/CMakeLists.txt @@ -30,7 +30,8 @@ add_executable( target_include_directories( ${PROJECT_NAME} - PRIVATE ${CMAKE_SOURCE_DIR}/tests/auto/foundation/common ${CMAKE_BINARY_DIR}/tests/auto + PRIVATE ${CMAKE_SOURCE_DIR}/src/KDMqtt ${CMAKE_SOURCE_DIR}/tests/auto/foundation/common + ${CMAKE_BINARY_DIR}/tests/auto ) target_link_libraries( diff --git a/tests/auto/mqtt/tst_mqtt.cpp b/tests/auto/mqtt/tst_mqtt.cpp index 1be52875..b257c70a 100644 --- a/tests/auto/mqtt/tst_mqtt.cpp +++ b/tests/auto/mqtt/tst_mqtt.cpp @@ -11,6 +11,7 @@ #include #include #include +#include "mosquitto_wrapper.h" #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #include