From 86ed154c926aa07b67c1bcc73336bbf8320cc040 Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Sun, 18 Mar 2018 18:57:09 -0700 Subject: [PATCH] Link with ws2_32.lib on Windows --- src/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 758e59d..d35462b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,7 +26,13 @@ include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${RDKAFKA_INCLUDE_DIR}) add_library(cppkafka ${CPPKAFKA_LIBRARY_TYPE} ${SOURCES}) set_target_properties(cppkafka PROPERTIES VERSION ${CPPKAFKA_VERSION} SOVERSION ${CPPKAFKA_VERSION}) -target_link_libraries(cppkafka ${RDKAFKA_LIBRARY}) + +set(DEPENDENCIES ${RDKAFKA_LIBRARY}) +if (WIN32) + # On windows ntohs and related are in ws2_32 + set(DEPENDENCIES "${DEPENDENCIES} ws2_32.lib") +endif() +target_link_libraries(cppkafka ${DEPENDENCIES}) target_include_directories(cppkafka PUBLIC ${PROJECT_SOURCE_DIR}/include) install(