cmake: only fallback to vendored miniupnpc

This commit is contained in:
selsta 2022-08-16 03:32:02 +02:00
parent b6a029f222
commit 7ce309b421
No known key found for this signature in database
GPG Key ID: 2EA0A99A8B07AE5E
3 changed files with 19 additions and 17 deletions

View File

@ -37,7 +37,7 @@ set(MINIUPNP_STATIC_LIBRARIES ${MINIUPNP_STATIC_LIBRARY})
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args( find_package_handle_standard_args(
MiniUPnPc DEFAULT_MSG Miniupnpc DEFAULT_MSG
MINIUPNP_INCLUDE_DIR MINIUPNP_INCLUDE_DIR
MINIUPNP_LIBRARY MINIUPNP_LIBRARY
) )

View File

@ -35,23 +35,25 @@
# ...except for FreeBSD, because FreeBSD is a special case that doesn't play well with # ...except for FreeBSD, because FreeBSD is a special case that doesn't play well with
# others. # others.
find_package(Miniupnpc REQUIRED) find_package(Miniupnpc)
message(STATUS "Using in-tree miniupnpc") if(NOT MINIUPNP_FOUND)
set(UPNPC_NO_INSTALL TRUE CACHE BOOL "Disable miniupnp installation" FORCE) message(STATUS "Using in-tree miniupnpc")
add_subdirectory(miniupnp/miniupnpc) set(UPNPC_NO_INSTALL TRUE CACHE BOOL "Disable miniupnp installation" FORCE)
set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external") add_subdirectory(miniupnp/miniupnpc)
set_property(TARGET libminiupnpc-static PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external")
if(MSVC) set_property(TARGET libminiupnpc-static PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267") if(MSVC)
elseif(NOT MSVC) set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value") elseif(NOT MSVC)
endif() set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
if(CMAKE_SYSTEM_NAME MATCHES "NetBSD") endif()
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE") if(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
endif() set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE")
endif()
set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE) set(MINIUPNP_LIBRARY "libminiupnpc-static" PARENT_SCOPE)
endif()
find_package(Unbound) find_package(Unbound)

View File

@ -41,7 +41,7 @@ target_link_libraries(p2p
version version
cryptonote_core cryptonote_core
net net
${UPNP_LIBRARIES} ${MINIUPNP_LIBRARY}
${Boost_CHRONO_LIBRARY} ${Boost_CHRONO_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}