[CMAKE] Add support for Miniupnpc
Summary:
This diff adds support for UPnP and an option to disable it by setting
-DENABLE_UPNP=OFF on the cmake command line.
It also adds an option START_WITH_UPNP which can be turned ON to set
UPnP as the default to map ports (OFF by default).
Test Plan:
With libminiupnpc installed:
mkdir buildcmake && cd buildcmake cmake -GNinja .. -DENABLE_UPNP=OFF ninja ./src/qt/bitcoin-qt
Go to Settings->Options...
Click on the Network tab.
Check the Map port using UPnP checkbox is dimmed.
Close bitcoin-qt.
rm -rf * cmake -GNinja .. ninja ./src/qt/bitcoin-qt
Go to Settings->Options...
Click on the Network tab.
Check the Map port using UPnP checkbox is not dimmed.
Uncheck Map port using UPnP and close bitcoin-qt.
Remove the line fUseUPnP=false from ~/.config/BitcoinABC/BitcoinABC-Qt.conf.
rm -rf * cmake -GNinja -DSTART_WITH_UPNP=ON .. ninja ./src/qt/bitcoin-qt
Go to Settings->Options...
Click on the Network tab.
Check the Map port using UPnP checkbox is not dimmed and is checked.
Uncheck Map port using UPnP and close bitcoin-qt.
Uninstall libminiupnpc. On Debian sudo apt remove libminiupnpc*
rm -rf * cmake -GNinja ..
Should return a CMake Error:
Could NOT find MiniUPnPc (missing: MINIUPNPC_INCLUDE_DIR MINIUPNPC_LIBRARY)
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D2997