explicit link to ws2_32 if targeting Windows

#pragma comment(lib,"Ws2_32.lib") in endian.h is a hack and is not portable. It only works for Visual Studio, not gcc or clang on Windows.
This commit is contained in:
SpaceIm 2023-10-10 11:03:53 +02:00
parent a1526bad8d
commit 2b17473cd6
1 changed files with 4 additions and 0 deletions

View File

@ -92,6 +92,10 @@ else()
add_library(${PROJECT_NAME} STATIC ${src_MAIN} ${src_LINUX_TCP})
endif()
if(WIN32)
target_link_libraries(${PROJECT_NAME} PUBLIC ws2_32)
endif()
# install rules
# ------------------------------------------------------------------------------------------------------