From 675647006aedaa21e8503949462e84aac7b88dce Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 22 Dec 2021 16:17:10 -0500 Subject: [PATCH] Add find routines for Mosquitto and Mosquittopp. Shamelessl ripped from https://github.com/devicehubnet/devicehub_cpp --- cmake/Modules/FindMosquitto.cmake | 28 ++++++++++++++++++++++++++++ cmake/Modules/FindMosquittopp.cmake | 28 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 cmake/Modules/FindMosquitto.cmake create mode 100644 cmake/Modules/FindMosquittopp.cmake diff --git a/cmake/Modules/FindMosquitto.cmake b/cmake/Modules/FindMosquitto.cmake new file mode 100644 index 000000000..ad9acd261 --- /dev/null +++ b/cmake/Modules/FindMosquitto.cmake @@ -0,0 +1,28 @@ +# - Find libmosquitto +# Find the native libmosquitto includes and libraries +# +# MOSQUITTO_INCLUDE_DIR - where to find mosquitto.h, etc. +# MOSQUITTO_LIBRARIES - List of libraries when using libmosquitto. +# MOSQUITTO_FOUND - True if libmosquitto found. + +if(MOSQUITTO_INCLUDE_DIR) + # Already in cache, be silent + set(MOSQUITTO_FIND_QUIETLY TRUE) +endif(MOSQUITTO_INCLUDE_DIR) + +find_path(MOSQUITTO_INCLUDE_DIR mosquitto.h) + +find_library(MOSQUITTO_LIBRARY NAMES libmosquitto mosquitto) + +# Handle the QUIETLY and REQUIRED arguments and set MOSQUITTO_FOUND to TRUE if +# all listed variables are TRUE. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MOSQUITTO DEFAULT_MSG MOSQUITTO_LIBRARY MOSQUITTO_INCLUDE_DIR) + +if(MOSQUITTO_FOUND) + set(MOSQUITTO_LIBRARIES ${MOSQUITTO_LIBRARY}) +else(MOSQUITTO_FOUND) + set(MOSQUITTO_LIBRARIES) +endif(MOSQUITTO_FOUND) + +mark_as_advanced(MOSQUITTO_INCLUDE_DIR MOSQUITTO_LIBRARY) diff --git a/cmake/Modules/FindMosquittopp.cmake b/cmake/Modules/FindMosquittopp.cmake new file mode 100644 index 000000000..49ac23e48 --- /dev/null +++ b/cmake/Modules/FindMosquittopp.cmake @@ -0,0 +1,28 @@ +# - Find libmosquitto +# Find the native libmosquitto includes and libraries +# +# MOSQUITTOPP_INCLUDE_DIR - where to find mosquitto.h, etc. +# MOSQUITTOPP_LIBRARIES - List of libraries when using libmosquitto. +# MOSQUITTOPP_FOUND - True if libmosquitto found. + +if(MOSQUITTOPP_INCLUDE_DIR) + # Already in cache, be silent + set(MOSQUITTOPP_FIND_QUIETLY TRUE) +endif(MOSQUITTOPP_INCLUDE_DIR) + +find_path(MOSQUITTOPP_INCLUDE_DIR mosquitto.h) + +find_library(MOSQUITTOPP_LIBRARY NAMES libmosquittopp mosquittopp) + +# Handle the QUIETLY and REQUIRED arguments and set MOSQUITTO_FOUND to TRUE if +# all listed variables are TRUE. +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MOSQUITTOPP DEFAULT_MSG MOSQUITTOPP_LIBRARY MOSQUITTOPP_INCLUDE_DIR) + +if(MOSQUITTOPP_FOUND) + set(MOSQUITTOPP_LIBRARIES ${MOSQUITTOPP_LIBRARY}) +else(MOSQUITTOPP_FOUND) + set(MOSQUITTOPP_LIBRARIES) +endif(MOSQUITTOPP_FOUND) + +mark_as_advanced(MOSQUITTOPP_INCLUDE_DIR MOSQUITTOPP_LIBRARY)