You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.4 KiB

  1. --- /dev/null
  2. +++ b/CMakeLists.txt
  3. @@ -0,0 +1,50 @@
  4. +cmake_minimum_required(VERSION 2.8.12)
  5. +
  6. +if(POLICY CMP0048)
  7. + cmake_policy(SET CMP0048 NEW)
  8. +endif()
  9. +
  10. +project(natpmp C)
  11. +
  12. +set (NATPMP_VERSION 20150609)
  13. +set (NATPMP_API_VERSION 1)
  14. +
  15. +set (NATPMP_SOURCES
  16. + natpmp.c
  17. + getgateway.c
  18. +)
  19. +
  20. +if (WIN32)
  21. + set (NATPMP_SOURCES ${NATPMP_SOURCES} wingettimeofday.c)
  22. +endif (WIN32)
  23. +
  24. +# Library itself
  25. +add_library(natpmp SHARED ${NATPMP_SOURCES})
  26. +set_target_properties (natpmp PROPERTIES OUTPUT_NAME "natpmp")
  27. +set_target_properties (natpmp PROPERTIES VERSION ${NATPMP_VERSION})
  28. +set_target_properties (natpmp PROPERTIES SOVERSION ${NATPMP_API_VERSION})
  29. +target_compile_definitions(natpmp PRIVATE -DENABLE_STRNATPMPERR)
  30. +target_include_directories(natpmp PUBLIC ${CMAKE_CURRENT_LIST_DIR})
  31. +
  32. +if (WIN32)
  33. + target_link_libraries(natpmp PUBLIC ws2_32 Iphlpapi)
  34. + target_compile_definitions(natpmp PUBLIC -DNATPMP_STATICLIB)
  35. +endif (WIN32)
  36. +
  37. +install(TARGETS natpmp
  38. + RUNTIME DESTINATION bin
  39. + LIBRARY DESTINATION lib${LIB_SUFFIX}
  40. + ARCHIVE DESTINATION lib${LIB_SUFFIX})
  41. +
  42. +# Executables
  43. +add_executable(natpmpc natpmpc.c)
  44. +target_link_libraries(natpmpc natpmp)
  45. +
  46. +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/natpmpc DESTINATION bin)
  47. +
  48. +add_executable(testgetgateway
  49. + testgetgateway.c
  50. + getgateway.c)
  51. +target_link_libraries(testgetgateway natpmp)
  52. +
  53. +install(FILES natpmp.h DESTINATION include)