Files
buildroot/package/mosquitto/0001-Fix-CMake-builds-with-WITH_TLS-OFF.patch
Scott Fan 2c20a2541c package/mosquitto: bump to version 2.0.22
Drop the patch that was fixed in the v2.0.22, see the closed issues and PRs:
https://github.com/eclipse-mosquitto/mosquitto/issues/3246
https://github.com/eclipse-mosquitto/mosquitto/pull/3256
https://github.com/eclipse-mosquitto/mosquitto/pull/3227
https://github.com/eclipse-mosquitto/mosquitto/pull/3252

However, a new issue was reported by GasparQ, when WITH_TLS option is off.
https://github.com/eclipse-mosquitto/mosquitto/issues/3318

Fortunately, besmarsh had pushed a PR that fixed this issue.
https://github.com/eclipse-mosquitto/mosquitto/pull/3321

The patch file was quoted in this commit.

For more details of v2.0.22, see the changelog:
https://github.com/eclipse-mosquitto/mosquitto/blob/v2.0.22/ChangeLog.txt

Signed-off-by: Scott Fan <fancp2007@gmail.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
2025-07-26 13:22:19 +02:00

51 lines
1.6 KiB
Diff

From 1ecc94d7b4ff495afd7f32c42072cdf4ea5407aa Mon Sep 17 00:00:00 2001
From: Ben Marsh <ben.marsh555@googlemail.com>
Date: Mon, 21 Jul 2025 17:46:16 +0100
Subject: [PATCH] Fix CMake builds with WITH_TLS=OFF
Recent CMake changes caused CMake builds with the WITH_TLS option set to OFF to fail. The OpenSSL package is only found (find_package()) if WITH_TLS is ON, but linking to OpenSSL for the broker and library is not guarded by WITH_TLS. The build therefore fails.
Guard linking to OpenSSL, only linking if WITH_TLS is set.
Upstream: https://github.com/eclipse-mosquitto/mosquitto/pull/3321
Signed-off-by: Scott Fan <fancp2007@gmail.com>
---
lib/CMakeLists.txt | 4 +++-
src/CMakeLists.txt | 5 ++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 21b61497..e6b8235b 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -60,7 +60,9 @@ set(C_SRC
util_mosq.c util_topic.c util_mosq.h
will_mosq.c will_mosq.h)
-set (LIBRARIES OpenSSL::SSL)
+if (WITH_TLS)
+ set (LIBRARIES OpenSSL::SSL)
+endif()
if (UNIX AND NOT APPLE AND NOT ANDROID)
find_library(LIBRT rt)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d4bae7cd..6fd0ee53 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -163,7 +163,10 @@ if (WITH_DLT)
set (MOSQ_LIBS ${MOSQ_LIBS} ${DLT_LIBRARIES})
endif (WITH_DLT)
-set (MOSQ_LIBS ${MOSQ_LIBS} OpenSSL::SSL)
+if (WITH_TLS)
+ set (MOSQ_LIBS ${MOSQ_LIBS} OpenSSL::SSL)
+endif()
+
# Check for getaddrinfo_a
include(CheckLibraryExists)
check_library_exists(anl getaddrinfo_a "" HAVE_GETADDRINFO_A)
--
2.43.0