diff --git a/cmake/modules/FindMiniUPnPc.cmake b/cmake/modules/FindMiniUPnPc.cmake --- a/cmake/modules/FindMiniUPnPc.cmake +++ b/cmake/modules/FindMiniUPnPc.cmake @@ -67,6 +67,7 @@ PATHS ${PC_MiniUPnPc_LIBRARY_DIRS} PATH_SUFFIXES miniupnpc INCLUDE_DIRS ${MiniUPnPc_INCLUDE_DIRS} + INTERFACE_LINK_LIBRARIES "$<$:ws2_32;iphlpapi>" ) include(FindPackageHandleStandardArgs) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -528,12 +528,9 @@ target_link_libraries(server MiniUPnPc::miniupnpc) if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") - find_library(IPHLPAPI_LIBRARY NAMES iphlpapi) - if(NOT IPHLPAPI_LIBRARY) - message(FATAL_ERROR "Lib iphlpapi is missing") - endif() - target_link_libraries(server ${IPHLPAPI_LIBRARY}) - + # TODO: check if we are really using a static library. Assume this is + # the one from the depends for now since the native windows build is not + # supported. target_compile_definitions(server PUBLIC -DSTATICLIB PUBLIC -DMINIUPNP_STATICLIB