CMake: simplify FindMiniupnpc.cmake

miniupnpc.h provides MINIUPNPC_API_VERSION since 1.7 and we require 1.7
or later, so there is no reason to have version detection code for older
versions.
This commit is contained in:
Tillmann Karras
2015-10-12 02:26:35 +02:00
parent c8382cca83
commit 4eace2b49e
3 changed files with 19 additions and 212 deletions

View File

@ -690,19 +690,17 @@ if(USE_UPNP)
if(NOT APPLE AND NOT ANDROID)
include(FindMiniupnpc)
endif()
if(MINIUPNP_FOUND AND (MINIUPNPC_VERSION_1_7_OR_HIGHER OR MINIUPNPC_VERSION_API14_OR_HIGHER))
if(MINIUPNPC_FOUND AND MINIUPNPC_API_VERSION GREATER 8)
message("Using shared miniupnpc")
include_directories(${MINIUPNP_INCLUDE_DIR})
if (MINIUPNPC_VERSION_API14_OR_HIGHER)
add_definitions(-DUPNPDISCOVER_HAS_TTL)
endif()
else()
message("Using static miniupnpc from Externals")
add_subdirectory(Externals/miniupnpc)
include_directories(Externals/miniupnpc/src)
set(MINIUPNPC_INCLUDE_DIRS Externals/miniupnpc/src)
set(MINIUPNPC_LIBRARIES miniupnpc)
endif()
add_definitions(-DUSE_UPNP)
list(APPEND LIBS miniupnpc)
include_directories(${MINIUPNPC_INCLUDE_DIRS})
list(APPEND LIBS ${MINIUPNPC_LIBRARIES})
endif()
if(NOT APPLE AND NOT ANDROID)