From 81cdda7deff73f184646cbbb8bd4dec72ac7cb19 Mon Sep 17 00:00:00 2001
From: Isaac Connor <iconnor@connortechnology.com>
Date: Wed, 22 Dec 2021 16:15:48 -0500
Subject: [PATCH] Add Mosquitto and Mosquittopp library detection

---
 CMakeLists.txt | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6337e50c2..75bff3aec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -432,8 +432,28 @@ if(NOT ZM_NO_PRCE)
   endif()
 endif()
 
+if(NOT ZM_NO_MQTT)
+  find_package(Mosquitto)
+  if(MOSQUITTO_FOUND)
+    include_directories(${MOSQUITTO_INCLUDE_DIRS})
+    list(APPEND ZM_BIN_LIBS "${MOSQUITTO_LIBRARIES}")
+    set(optlibsfound "${optlibsfound} Mosquitto")
+  else()
+    set(optlibsnotfound "${optlibsnotfound} Mosquitto")
+  endif (MOSQUITTO_FOUND)
+
+  find_package(Mosquittopp)
+  if(MOSQUITTOPP_FOUND)
+    include_directories(${MOSQUITTOPP_INCLUDE_DIRS})
+    list(APPEND ZM_BIN_LIBS "${MOSQUITTOPP_LIBRARIES}")
+    set(optlibsfound "${optlibsfound} Mosquittopp")
+  else()
+    set(optlibsnotfound "${optlibsnotfound} Mosquittopp")
+  endif (MOSQUITTOPP_FOUND)
+endif()
+
 # mysqlclient (using find_library and find_path)
-find_library(MYSQLCLIENT_LIBRARIES mysqlclient PATH_SUFFIXES mysql)
+  find_library(MYSQLCLIENT_LIBRARIES mysqlclient PATH_SUFFIXES mysql)
 if(MYSQLCLIENT_LIBRARIES)
   set(HAVE_LIBMYSQLCLIENT 1)
   list(APPEND ZM_BIN_LIBS "${MYSQLCLIENT_LIBRARIES}")