vcpkg/ports/paho-mqtt/fix-ODR-libuuid-linux.patch

39 lines
1.8 KiB
Diff
Raw Normal View History

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4c06409..29f53c0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -95,6 +95,12 @@ ADD_LIBRARY(common_obj_static OBJECT ${common_src})
SET_TARGET_PROPERTIES(common_obj_static PROPERTIES
POSITION_INDEPENDENT_CODE ON
COMPILE_DEFINITIONS "PAHO_MQTT_STATIC=1")
+ IF(WIN32 OR APPLE)
+ ELSE()
+ find_package(unofficial-libuuid CONFIG REQUIRED)
+ target_link_libraries(common_obj_static PRIVATE unofficial::UUID::uuid)
+ target_compile_definitions(common_obj_static PUBLIC LIBUUID)
+ ENDIF()
ENDIF()
IF (PAHO_BUILD_SHARED)
@@ -149,7 +155,6 @@ ENDIF()
IF (PAHO_BUILD_STATIC)
ADD_LIBRARY(paho-mqtt3c-static STATIC $<TARGET_OBJECTS:common_obj_static> MQTTClient.c)
ADD_LIBRARY(paho-mqtt3a-static STATIC $<TARGET_OBJECTS:common_obj_static> MQTTAsync.c MQTTAsyncUtils.c)
-
TARGET_LINK_LIBRARIES(paho-mqtt3c-static ${LIBS_SYSTEM})
TARGET_LINK_LIBRARIES(paho-mqtt3a-static ${LIBS_SYSTEM})
IF (NOT WIN32)
@@ -249,6 +254,12 @@ IF (PAHO_WITH_SSL)
TARGET_INCLUDE_DIRECTORIES(common_ssl_obj_static PUBLIC ${OPENSSL_INCLUDE_DIR})
SET_PROPERTY(TARGET common_ssl_obj_static PROPERTY POSITION_INDEPENDENT_CODE ON)
SET_PROPERTY(TARGET common_ssl_obj_static PROPERTY COMPILE_DEFINITIONS "OPENSSL=1;PAHO_MQTT_STATIC=1")
+ IF(WIN32 OR APPLE)
+ ELSE()
+ find_package(unofficial-libuuid CONFIG REQUIRED)
+ target_link_libraries(common_ssl_obj_static PRIVATE unofficial::UUID::uuid)
+ target_compile_definitions(common_ssl_obj_static PUBLIC LIBUUID)
+ ENDIF()
ADD_LIBRARY(paho-mqtt3cs-static STATIC $<TARGET_OBJECTS:common_ssl_obj_static> MQTTClient.c SSLSocket.c)
ADD_LIBRARY(paho-mqtt3as-static STATIC $<TARGET_OBJECTS:common_ssl_obj_static> MQTTAsync.c MQTTAsyncUtils.c SSLSocket.c)