Re: [PATCH] Fix linking errors when building with MinGW.

2020-05-02 Thread Marc Lehmann
On Sat, May 02, 2020 at 05:27:10PM +0800, DDoSolitary  
wrote:
> One will get errors like "undefined reference to __imp_htonl" when
> trying to build libev with MinGW on Windows. This patch fixes this by
> linking to ws2_32, which provides winsock functions.

Hmm, the patch doesn't seem to be for libev - Are you sure you got the
right project and not something else that embeds libev?

-- 
The choice of a   Deliantra, the free code+content MORPG
  -==- _GNU_  http://www.deliantra.net
  ==-- _   generation
  ---==---(_)__  __   __  Marc Lehmann
  --==---/ / _ \/ // /\ \/ /  schm...@schmorp.de
  -=/_/_//_/\_,_/ /_/\_\

___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev


[PATCH] Fix linking errors when building with MinGW.

2020-05-02 Thread DDoSolitary
One will get errors like "undefined reference to __imp_htonl" when
trying to build libev with MinGW on Windows. This patch fixes this by
linking to ws2_32, which provides winsock functions.
---
 CMakeLists.txt | 4 
 1 file changed, 4 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 299e5cf..07c4dff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -196,6 +196,10 @@ if(BUILD_SHARED_LIBS)
 target_link_libraries(ev ${LIBRT_NAME} ${LIBM_NAME})
 endif()
 
+if (MINGW)
+target_link_libraries(ev ws2_32)
+endif()
+
 create_libtool_file(ev_static /lib)
 
 install(TARGETS ev LIBRARY DESTINATION lib)
-- 
2.26.2




signature.asc
Description: OpenPGP digital signature
___
libev mailing list
libev@lists.schmorp.de
http://lists.schmorp.de/mailman/listinfo/libev