From f2a15f4abf09004f752e9908b20c933b61d273c9 Mon Sep 17 00:00:00 2001 From: Florian Kauer Date: Mon, 19 Jul 2021 09:00:07 +0200 Subject: [PATCH] avoid adding Paho MQTT C library twice Signed-off-by: Florian Kauer --- cmake/FindPahoMqttC.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/FindPahoMqttC.cmake b/cmake/FindPahoMqttC.cmake index b3e7ec39..b2fc066e 100644 --- a/cmake/FindPahoMqttC.cmake +++ b/cmake/FindPahoMqttC.cmake @@ -17,7 +17,9 @@ find_library(PAHO_MQTT_C_LIBRARIES NAMES ${_PAHO_MQTT_C_LIB_NAME}) unset(_PAHO_MQTT_C_LIB_NAME) find_path(PAHO_MQTT_C_INCLUDE_DIRS NAMES MQTTAsync.h) -add_library(PahoMqttC::PahoMqttC UNKNOWN IMPORTED) +if (NOT TARGET PahoMqttC::PahoMqttC) + add_library(PahoMqttC::PahoMqttC UNKNOWN IMPORTED) +endif () set_target_properties(PahoMqttC::PahoMqttC PROPERTIES IMPORTED_LOCATION "${PAHO_MQTT_C_LIBRARIES}"