diff --git a/CMakeLists.txt b/CMakeLists.txt index ddf13f572c..5ad5d14dad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2050,6 +2050,7 @@ if(USE_MINIUPNPC) find_package(MINIUPNPC REQUIRED) target_include_directories(${CoreLibName} PRIVATE ${MINIUPNP_INCLUDE_DIR}) target_link_libraries(${CoreLibName} ${MINIUPNP_LIBRARY}) + add_definitions(-DWITH_UPNP -DUSE_SYSTEM_MINIUPNPC) else() set (MINIUPNPC_VERSION 2.1) # used by miniupnpcstrings.h.cmake set (MINIUPNPC_API_VERSION 17) @@ -2068,7 +2069,7 @@ if(USE_MINIUPNPC) add_definitions (-D_DARWIN_C_SOURCE) endif() if(WIN32) - add_definitions(-DWIN32 -DMINIUPNP_EXPORTS ) + add_definitions(-DWIN32 -DMINIUPNP_EXPORTS) else() add_definitions(-fPIC) endif() diff --git a/Core/Util/PortManager.h b/Core/Util/PortManager.h index a4c7df6c27..67f99a8fc5 100644 --- a/Core/Util/PortManager.h +++ b/Core/Util/PortManager.h @@ -21,14 +21,18 @@ #pragma once - +#ifdef USE_SYSTEM_MINIUPNPC +#include +#include +#include +#else #ifndef MINIUPNP_STATICLIB #define MINIUPNP_STATICLIB #endif - #include "ext/miniupnp/miniupnpc/miniwget.h" #include "ext/miniupnp/miniupnpc/miniupnpc.h" #include "ext/miniupnp/miniupnpc/upnpcommands.h" +#endif #include #include