Add support for MINGW compiler
This commit is contained in:
parent
aa7255c2e5
commit
328d44fbb6
2 changed files with 15 additions and 4 deletions
|
@ -30,8 +30,14 @@ set_target_properties(UDPConnection PROPERTIES VERSION ${UDPConnection_VERSION})
|
||||||
target_compile_features(UDPConnection PUBLIC cxx_std_17)
|
target_compile_features(UDPConnection PUBLIC cxx_std_17)
|
||||||
target_link_libraries(UDPConnection PUBLIC pthread)
|
target_link_libraries(UDPConnection PUBLIC pthread)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(UDPConnection PUBLIC Ws2_32)
|
if(MINGW)
|
||||||
target_link_libraries(UDPConnection PUBLIC Iphlpapi)
|
target_compile_definitions(UDPConnection PUBLIC UDPC_PLATFORM_MINGW)
|
||||||
|
target_link_libraries(UDPConnection PUBLIC ws2_32)
|
||||||
|
target_link_libraries(UDPConnection PUBLIC iphlpapi)
|
||||||
|
else()
|
||||||
|
target_link_libraries(UDPConnection PUBLIC Ws2_32)
|
||||||
|
target_link_libraries(UDPConnection PUBLIC Iphlpapi)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(UDPConnection PUBLIC
|
target_include_directories(UDPConnection PUBLIC
|
||||||
|
|
|
@ -20,8 +20,13 @@
|
||||||
// OS-based networking macros
|
// OS-based networking macros
|
||||||
#if UDPC_PLATFORM == UDPC_PLATFORM_WINDOWS
|
#if UDPC_PLATFORM == UDPC_PLATFORM_WINDOWS
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <Ws2ipdef.h>
|
# ifdef UDPC_PLATFORM_MINGW
|
||||||
#include <In6addr.h>
|
# include <ws2ipdef.h>
|
||||||
|
# include <in6addr.h>
|
||||||
|
# else
|
||||||
|
# include <Ws2ipdef.h>
|
||||||
|
# include <In6addr.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
#define UDPC_CLEANUPSOCKET(x) closesocket(x)
|
#define UDPC_CLEANUPSOCKET(x) closesocket(x)
|
||||||
#define UDPC_SOCKETTYPE SOCKET
|
#define UDPC_SOCKETTYPE SOCKET
|
||||||
|
|
Loading…
Reference in a new issue