fix(odr): Fix ODR violation for libuuid symbols

Signed-off-by: Michael Bleis <michael.bleis@aracom.de>
This commit is contained in:
Michael Bleis 2023-03-01 11:54:06 +01:00 committed by Ian Craggs
parent 43a7b48c03
commit aebb8bb6d3
2 changed files with 9 additions and 4 deletions

View File

@ -44,6 +44,7 @@ ENDIF()
## build options
SET(PAHO_WITH_SSL FALSE CACHE BOOL "Flag that defines whether to build ssl-enabled binaries too. ")
SET(PAHO_WITH_LIBUUID TRUE CACHE BOOL "Flag that defines whether libuuid or a custom uuid implementation should be used")
SET(PAHO_BUILD_SHARED TRUE CACHE BOOL "Build shared library")
SET(PAHO_BUILD_STATIC FALSE CACHE BOOL "Build static library")
SET(PAHO_BUILD_DOCUMENTATION FALSE CACHE BOOL "Create and install the HTML based API documentation (requires Doxygen)")
@ -62,6 +63,10 @@ IF (PAHO_USE_SELECT)
ADD_DEFINITIONS(-DUSE_SELECT=1)
ENDIF()
IF (PAHO_WITH_LIBUUID)
ADD_DEFINITIONS(-DUSE_LIBUUID=1)
ENDIF()
IF (NOT PAHO_BUILD_SHARED AND NOT PAHO_BUILD_STATIC)
MESSAGE(FATAL_ERROR "You must set either PAHO_BUILD_SHARED, PAHO_BUILD_STATIC, or both")
ENDIF()

View File

@ -89,7 +89,7 @@
#define HTTP_PROTOCOL(x) x ? "https" : "http"
#if !(defined(_WIN32) || defined(_WIN64))
#if defined(LIBUUID)
#if defined(USE_LIBUUID)
#include <uuid/uuid.h>
#else /* if defined(USE_LIBUUID) */
#include <limits.h>
@ -103,7 +103,7 @@ typedef unsigned char uuid_t[16];
* @brief generates a uuid, compatible with RFC 4122, version 4 (random)
* @note Uses a very insecure algorithm but no external dependencies
*/
void uuid_generate( uuid_t out )
static void uuid_generate( uuid_t out )
{
#if defined(OPENSSL)
int rc = RAND_bytes( out, sizeof(uuid_t));
@ -121,7 +121,7 @@ void uuid_generate( uuid_t out )
}
/** @brief converts a uuid to a string */
void uuid_unparse( uuid_t uu, char *out )
static void uuid_unparse( uuid_t uu, char *out )
{
int i;
for ( i = 0; i < 16; ++i )
@ -135,7 +135,7 @@ void uuid_unparse( uuid_t uu, char *out )
}
*out = '\0';
}
#endif /* else if defined(LIBUUID) */
#endif /* else if defined(USE_LIBUUID) */
#endif /* if !(defined(_WIN32) || defined(_WIN64)) */
#include "Heap.h"