Skip to content

Commit

Permalink
cmake [KILL 3-STATE]: Switch WITH_NATPMP to boolean w/ default OFF
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Apr 22, 2024
1 parent dc20cdf commit a4d6a0c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ option(REDUCE_EXPORTS "Attempt to reduce exported symbols in the resulting execu
option(WERROR "Treat compiler warnings as errors." OFF)

tristate_option(CCACHE "Use ccache for compiling." "if ccache is found." AUTO)
tristate_option(WITH_NATPMP "Enable NAT-PMP." "if libnatpmp is found." AUTO)

option(WITH_NATPMP "Enable NAT-PMP." OFF)
if(WITH_NATPMP)
find_package(NATPMP MODULE REQUIRED)
endif()

tristate_option(WITH_MINIUPNPC "Enable UPnP." "if libminiupnpc is found." AUTO)
tristate_option(WITH_ZMQ "Enable ZMQ notifications." "if libzmq is found." AUTO)
tristate_option(WITH_USDT
Expand Down
13 changes: 0 additions & 13 deletions cmake/optional.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,6 @@ if(CCACHE)
mark_as_advanced(CCACHE_COMMAND)
endif()

if(WITH_NATPMP)
find_package(NATPMP MODULE)
if(NATPMP_FOUND)
set(WITH_NATPMP ON)
elseif(WITH_NATPMP STREQUAL "AUTO")
message(WARNING "libnatpmp not found, disabling.\n"
"To skip libnatpmp check, use \"-DWITH_NATPMP=OFF\".\n")
set(WITH_NATPMP OFF)
else()
message(FATAL_ERROR "libnatpmp requested, but not found.")
endif()
endif()

if(WITH_MINIUPNPC)
find_package(MiniUPnPc MODULE)
if(MiniUPnPc_FOUND)
Expand Down
6 changes: 4 additions & 2 deletions depends/toolchain.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ if(NOT WITH_MINIUPNPC AND "@no_upnp@" STREQUAL "1")
set(WITH_MINIUPNPC OFF CACHE STRING "Enable UPnP.")
endif()

if(NOT WITH_NATPMP AND "@no_natpmp@" STREQUAL "1")
set(WITH_NATPMP OFF CACHE STRING "Enable NAT-PMP.")
if("@no_natpmp@")
set(WITH_NATPMP OFF CACHE BOOL "")
else()
set(WITH_NATPMP ON CACHE BOOL "")
endif()

if(NOT WITH_USDT AND "@no_usdt@" STREQUAL "1")
Expand Down

0 comments on commit a4d6a0c

Please sign in to comment.