[PATCH] Fix linking errors when building with MinGW.
DDoSolitary
ddosolitary at gmail.com
Sat May 2 11:27:10 CEST 2020
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20200502/84571960/attachment.sig>
More information about the libev
mailing list