if(USE_SYSTEM_MINIUPNPC)
  message(STATUS "RPCS3: using shared MiniUPnPc")
  pkg_check_modules(MiniUPnPc REQUIRED IMPORTED_TARGET miniupnpc>=2.3.3)
  add_library(3rdparty_miniupnpc INTERFACE)
  target_link_libraries(3rdparty_miniupnpc INTERFACE PkgConfig::MiniUPnPc)
  target_include_directories(3rdparty_miniupnpc INTERFACE PkgConfig::MiniUPnPc)
  list(TRANSFORM MiniUPnPc_INCLUDE_DIRS APPEND "/miniupnpc")
  target_include_directories(3rdparty_miniupnpc INTERFACE ${MiniUPnPc_INCLUDE_DIRS})
else()
  option (UPNPC_BUILD_STATIC "Build static library" TRUE)
  option (UPNPC_BUILD_SHARED "Build shared library" FALSE)
  option (UPNPC_BUILD_TESTS "Build test executables" FALSE)
  option (UPNPC_BUILD_SAMPLE "Build sample executables" FALSE)
  option (NO_GETADDRINFO "Define NO_GETADDRINFO" FALSE)
  option (UPNPC_NO_INSTALL "Disable installation" TRUE)

  add_subdirectory(miniupnp/miniupnpc EXCLUDE_FROM_ALL)
  add_library(3rdparty_miniupnpc INTERFACE)
  target_link_libraries(3rdparty_miniupnpc INTERFACE libminiupnpc-static)
  target_include_directories(3rdparty_miniupnpc INTERFACE libminiupnpc-static)
endif()
