From 118abd2f53e24a4f312ad0fcd484f6f8dbe5094c Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Fri, 18 Dec 2020 13:03:53 +0100 Subject: [PATCH] fix MinGW --- include/libmemcachedprotocol-0/callback.h | 2 +- src/libmemcached/CMakeLists.txt | 2 +- src/libmemcachedprotocol/CMakeLists.txt | 2 +- src/libmemcachedutil/CMakeLists.txt | 6 ++---- src/libmemcachedutil/pool.cc | 1 + 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/libmemcachedprotocol-0/callback.h b/include/libmemcachedprotocol-0/callback.h index 55382e29..02f9566e 100644 --- a/include/libmemcachedprotocol-0/callback.h +++ b/include/libmemcachedprotocol-0/callback.h @@ -22,7 +22,7 @@ extern "C" { # include #endif -#ifdef _MSC_VER +#if defined _WIN32 # undef interface #endif diff --git a/src/libmemcached/CMakeLists.txt b/src/libmemcached/CMakeLists.txt index 0672fd40..51d2dd18 100644 --- a/src/libmemcached/CMakeLists.txt +++ b/src/libmemcached/CMakeLists.txt @@ -145,7 +145,7 @@ set_target_properties(libmemcachedinternal PROPERTIES CXX_STANDARD ${CXX_STANDAR target_compile_definitions(libmemcachedinternal PRIVATE -DBUILDING_LIBMEMCACHEDINTERNAL) target_link_libraries(libmemcachedinternal PUBLIC libhashkit Threads::Threads ${CMAKE_DL_LIBS}) target_link_libraries(libmemcachedinternal PRIVATE p9y) -if(MSVC) +if(MSVC OR MINGW) target_link_libraries(libmemcached PUBLIC wsock32 ws2_32) endif() if(HAVE_LIBSASL) diff --git a/src/libmemcachedprotocol/CMakeLists.txt b/src/libmemcachedprotocol/CMakeLists.txt index bdb7ba3e..74658008 100644 --- a/src/libmemcachedprotocol/CMakeLists.txt +++ b/src/libmemcachedprotocol/CMakeLists.txt @@ -23,7 +23,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL AppleClang) endif() target_link_libraries(libmemcachedprotocol PRIVATE p9y) target_link_libraries(libmemcachedprotocol PUBLIC Threads::Threads) -if(MSVC) +if(MSVC OR MINGW) target_link_libraries(libmemcachedprotocol PUBLIC wsock32 ws2_32) endif() target_include_directories(libmemcachedprotocol PRIVATE diff --git a/src/libmemcachedutil/CMakeLists.txt b/src/libmemcachedutil/CMakeLists.txt index 44e0c8a6..e08de188 100644 --- a/src/libmemcachedutil/CMakeLists.txt +++ b/src/libmemcachedutil/CMakeLists.txt @@ -22,10 +22,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL AppleClang) LINK_FLAGS "-Wl,-undefined,dynamic_lookup" ) endif() -if(MSVC) - set_target_properties(libmemcachedutil PROPERTIES - LINK_FLAGS "/FORCE:UNRESOLVED" - ) +if(MSVC OR MINGW) + target_link_libraries(libmemcachedutil PUBLIC libmemcached) endif() target_link_libraries(libmemcachedutil PUBLIC Threads::Threads) if(HAVE_LIBSASL) diff --git a/src/libmemcachedutil/pool.cc b/src/libmemcachedutil/pool.cc index 7a601d13..759b9576 100644 --- a/src/libmemcachedutil/pool.cc +++ b/src/libmemcachedutil/pool.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include -- 2.30.2