From 2b17473cd62bf08a694155acb87d04fa3c346eb1 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 10 Oct 2023 11:03:53 +0200 Subject: [PATCH] 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. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0aef3b1..0db28e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 # ------------------------------------------------------------------------------------------------------