ZeroTierOne/cmake/miniupnpc.cmake
Grant Limberg 7f3b15011e Update central controller build to use CMake + conda
Muuuuch easier to use external dependencies now

Also tried out conan and vcpkg.   Ran into dependency issues when solving for packages to install with conan.

vcpkg is just obtuse as all hell to install and not easy to integrate
2025-08-27 16:23:02 -07:00

30 lines
989 B
CMake

set(FETCHCONTENT_QUIET OFF)
FetchContent_Declare(
miniupnpc
URL https://github.com/miniupnp/miniupnp/releases/download/miniupnpc_2_3_3/miniupnpc-2.3.3.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
set(UPNPC_BUILD_TESTS FALSE CACHE INTERNAL "Build tests" FORCE)
set(UPNPC_BUILD_SHARED FALSE CACHE INTERNAL "Build shared library" FORCE)
set(UPNPC_BUILD_STATIC TRUE CACHE INTERNAL "Build static library" FORCE)
set(UPNPC_BUILD_SAMPLE FALSE CACHE INTERNAL "Build sample" FORCE)
FetchContent_MakeAvailable(miniupnpc)
if (NOT TARGET miniupnpc::miniupnpc)
message(FATAL_ERROR "A required miniupnpc target (miniupnpc::miniupnpc) was not imported")
endif()
add_definitions(-DZT_USE_MINIUPNPC)
FetchContent_Declare(
libnatpmp
GIT_REPOSITORY https://github.com/miniupnp/libnatpmp.git
GIT_TAG master
GIT_SHALLOW ON
)
FetchContent_MakeAvailable(libnatpmp)
if (NOT TARGET natpmp)
message(FATAL_ERROR "A required libnatpmp target (natpmp) was not imported")
endif()