diff --git a/external/paho_mqtt_c/CMakeLists.txt b/external/paho_mqtt_c/CMakeLists.txt index 0c658f6..7fa9562 100644 --- a/external/paho_mqtt_c/CMakeLists.txt +++ b/external/paho_mqtt_c/CMakeLists.txt @@ -23,31 +23,36 @@ opendaq_dependency( if (paho_mqtt_c_FETCHED) - # Apply WIN32_LEAN_AND_MEAN to the Paho MQTT C library as well - if(WIN32) - # Add global compile definition to prevent inclusion of winsock.h and force winsock2.h - foreach(tgt - paho-mqtt3a - paho-mqtt3a-static - paho-mqtt3c - paho-mqtt3c-static - paho-mqtt3as - paho-mqtt3as-static - common_obj - common_ssl_obj - common_obj_static - common_ssl_obj_static - ) - if(TARGET ${tgt}) + foreach(tgt + paho-mqtt3a + paho-mqtt3a-static + paho-mqtt3c + paho-mqtt3c-static + paho-mqtt3as + paho-mqtt3as-static + common_obj + common_ssl_obj + common_obj_static + common_ssl_obj_static + ) + if(TARGET ${tgt}) + # Apply WIN32_LEAN_AND_MEAN to the Paho MQTT C library as well + if(WIN32) + # Add global compile definition to prevent inclusion of winsock.h and force winsock2.h target_compile_definitions("${tgt}" PRIVATE _WINSOCKAPI_ NOMINMAX WIN32_LEAN_AND_MEAN) - if(MSVC) - target_compile_options(${tgt} PRIVATE /WX- /W0) - endif() endif() - endforeach() - if(MSVC) - target_compile_options(Base64Test PRIVATE /WX- /W0) - target_compile_options(Sha1Test PRIVATE /WX- /W0) + + # Don't let warnings in third-party Paho code fail the build (e.g. GCC 15 with + # glibc 2.43 reports discarded-qualifiers on strrchr() in MQTTProtocolOut.c) + if(MSVC) + target_compile_options(${tgt} PRIVATE /WX- /W0) + else() + target_compile_options(${tgt} PRIVATE -Wno-error) + endif() endif() + endforeach() + if(MSVC) + target_compile_options(Base64Test PRIVATE /WX- /W0) + target_compile_options(Sha1Test PRIVATE /WX- /W0) endif() endif()