Commit 7a66543e authored by Otavio Rodolfo Piske's avatar Otavio Rodolfo Piske

Fix compilation errors on test2 due to multiple symbol redefinitions

Signed-off-by: 's avatarOtavio Rodolfo Piske <opiske@redhat.com>
parent 81357e97
......@@ -4,6 +4,10 @@ SET(MQTT_TEST_BROKER "tcp://localhost:1883" CACHE STRING "Hostname of a test MQT
SET(MQTT_SSL_HOSTNAME "localhost" CACHE STRING "Hostname of a test SSL MQTT broker to use")
IF (WIN32)
ADD_DEFINITIONS(/DCMAKE_BUILD)
ENDIF()
ADD_EXECUTABLE(
test1
test1.c
......
......@@ -32,8 +32,15 @@
#include <errno.h>
#define WINAPI
#else
#include <winsock2.h>
#include <ws2tcpip.h>
#define WIN32_LEAN_AND_MEAN
#if !defined(CMAKE_BUILD)
/*
* These causes the cmake build to fail. In order to prevent affecting
* other builds, remove them only from CMAKE-related builds
*/
#include <winsock2.h>
#include <ws2tcpip.h>
#endif // CMAKE_BUILD
#define MAXHOSTNAMELEN 256
#define EAGAIN WSAEWOULDBLOCK
#define EINTR WSAEINTR
......@@ -42,6 +49,7 @@
#define ENOTCONN WSAENOTCONN
#define ECONNRESET WSAECONNRESET
#define setenv(a, b, c) _putenv_s(a, b)
#endif
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment