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}"