mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 07:28:39 +01:00
libnatpmp: Switch to CMake
Allows simplifying the Makefile. CMake patch is from upstream. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -56,7 +56,7 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
-HEADERS = natpmp.h
|
||||
+HEADERS = natpmp.h declspec.h
|
||||
|
||||
EXECUTABLES = testgetgateway natpmpc-shared natpmpc-static
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
--- /dev/null
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -0,0 +1,50 @@
|
||||
+cmake_minimum_required(VERSION 2.8.12)
|
||||
+
|
||||
+if(POLICY CMP0048)
|
||||
+ cmake_policy(SET CMP0048 NEW)
|
||||
+endif()
|
||||
+
|
||||
+project(natpmp C)
|
||||
+
|
||||
+set (NATPMP_VERSION 20150609)
|
||||
+set (NATPMP_API_VERSION 1)
|
||||
+
|
||||
+set (NATPMP_SOURCES
|
||||
+ natpmp.c
|
||||
+ getgateway.c
|
||||
+)
|
||||
+
|
||||
+if (WIN32)
|
||||
+ set (NATPMP_SOURCES ${NATPMP_SOURCES} wingettimeofday.c)
|
||||
+endif (WIN32)
|
||||
+
|
||||
+# Library itself
|
||||
+add_library(natpmp SHARED ${NATPMP_SOURCES})
|
||||
+set_target_properties (natpmp PROPERTIES OUTPUT_NAME "natpmp")
|
||||
+set_target_properties (natpmp PROPERTIES VERSION ${NATPMP_VERSION})
|
||||
+set_target_properties (natpmp PROPERTIES SOVERSION ${NATPMP_API_VERSION})
|
||||
+target_compile_definitions(natpmp PRIVATE -DENABLE_STRNATPMPERR)
|
||||
+target_include_directories(natpmp PUBLIC ${CMAKE_CURRENT_LIST_DIR})
|
||||
+
|
||||
+if (WIN32)
|
||||
+ target_link_libraries(natpmp PUBLIC ws2_32 Iphlpapi)
|
||||
+ target_compile_definitions(natpmp PUBLIC -DNATPMP_STATICLIB)
|
||||
+endif (WIN32)
|
||||
+
|
||||
+install(TARGETS natpmp
|
||||
+ RUNTIME DESTINATION bin
|
||||
+ LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
+ ARCHIVE DESTINATION lib${LIB_SUFFIX})
|
||||
+
|
||||
+# Executables
|
||||
+add_executable(natpmpc natpmpc.c)
|
||||
+target_link_libraries(natpmpc natpmp)
|
||||
+
|
||||
+install(FILES natpmpc DESTINATION bin)
|
||||
+
|
||||
+add_executable(testgetgateway
|
||||
+ testgetgateway.c
|
||||
+ getgateway.c)
|
||||
+target_link_libraries(testgetgateway natpmp)
|
||||
+
|
||||
+install(FILES natpmp.h DESTINATION include)
|
||||
Reference in New Issue
Block a user