miniupnpc.cmake 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. set(FETCHCONTENT_QUIET OFF)
  2. FetchContent_Declare(
  3. miniupnpc
  4. URL https://github.com/miniupnp/miniupnp/releases/download/miniupnpc_2_3_3/miniupnpc-2.3.3.tar.gz
  5. DOWNLOAD_EXTRACT_TIMESTAMP TRUE
  6. )
  7. set(UPNPC_BUILD_TESTS FALSE CACHE INTERNAL "Build tests" FORCE)
  8. set(UPNPC_BUILD_SHARED FALSE CACHE INTERNAL "Build shared library" FORCE)
  9. set(UPNPC_BUILD_STATIC TRUE CACHE INTERNAL "Build static library" FORCE)
  10. set(UPNPC_BUILD_SAMPLE FALSE CACHE INTERNAL "Build sample" FORCE)
  11. FetchContent_MakeAvailable(miniupnpc)
  12. if (NOT TARGET miniupnpc::miniupnpc)
  13. message(FATAL_ERROR "A required miniupnpc target (miniupnpc::miniupnpc) was not imported")
  14. endif()
  15. add_definitions(-DZT_USE_MINIUPNPC)
  16. FetchContent_Declare(
  17. libnatpmp
  18. GIT_REPOSITORY https://github.com/miniupnp/libnatpmp.git
  19. GIT_TAG master
  20. GIT_SHALLOW ON
  21. PATCH_COMMAND git apply ${CMAKE_SOURCE_DIR}/ext/cmake-patches/libnatpmp.patch
  22. UPDATE_DISCONNECTED TRUE
  23. )
  24. FetchContent_MakeAvailable(libnatpmp)
  25. if (NOT TARGET natpmp)
  26. message(FATAL_ERROR "A required libnatpmp target (natpmp) was not imported")
  27. endif()