From 959843ee9c1a63b7245ef8083480599a6ec92eb1 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Fri, 19 Aug 2016 12:16:28 +0300 Subject: [PATCH] Find miniupnpc library as well as header --- build/CMakeLists.txt | 2 +- build/cmake_modules/FindMiniUPnPc.cmake | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 99d6a5ad..f9f21fd4 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -357,7 +357,7 @@ if (WITH_BINARY) endif () if (WITH_UPNP) - target_link_libraries("${PROJECT_NAME}" "miniupnpc") + target_link_libraries("${PROJECT_NAME}" "${MINIUPNPC_LIBRARY}") endif () # FindBoost pulls pthread for thread which is broken for static linking at least on Ubuntu 15.04 diff --git a/build/cmake_modules/FindMiniUPnPc.cmake b/build/cmake_modules/FindMiniUPnPc.cmake index 8d5d3860..6a5d4220 100644 --- a/build/cmake_modules/FindMiniUPnPc.cmake +++ b/build/cmake_modules/FindMiniUPnPc.cmake @@ -1,6 +1,6 @@ # - Find MINIUPNPC -if(MINIUPNPC_INCLUDE_DIR) +if(MINIUPNPC_INCLUDE_DIR AND MINIUPNPC_LIBRARY) set(MINIUPNPC_FOUND TRUE) else() @@ -11,15 +11,18 @@ else() $ENV{SystemDrive} ${PROJECT_SOURCE_DIR}/../.. ) - - if(MINIUPNPC_INCLUDE_DIR) + + find_library(MINIUPNPC_LIBRARY miniupnpc) + + if(MINIUPNPC_INCLUDE_DIR AND MINIUPNPC_LIBRARY) set(MINIUPNPC_FOUND TRUE) message(STATUS "Found MiniUPnP headers: ${MINIUPNPC_INCLUDE_DIR}") + message(STATUS "Found MiniUPnP library: ${MINIUPNPC_LIBRARY}") else() set(MINIUPNPC_FOUND FALSE) message(STATUS "MiniUPnP not found.") endif() - mark_as_advanced(MINIUPNPC_INCLUDE_DIR) + mark_as_advanced(MINIUPNPC_INCLUDE_DIR MINIUPNPC_LIBRARY) endif()