0
0
mirror of https://github.com/openwrt/packages.git synced 2025-07-16 15:14:46 +00:00
Files
packages/libs/libnatpmp/patches/010-cmake.patch
Tianling Shen 2d00a149c6 libnatpmp: Update to 20230423
Rebased patches.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-07-02 09:36:28 -07:00

51 lines
1.4 KiB
Diff

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,10 @@ if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
-project(natpmp)
+project(natpmp C)
+
+set (NATPMP_VERSION 20230423)
+set (NATPMP_API_VERSION 1)
set (NATPMP_SOURCES
natpmp.c
@@ -16,20 +19,33 @@ if (WIN32)
endif (WIN32)
# Library itself
-add_library(natpmp STATIC ${NATPMP_SOURCES})
-target_include_directories(natpmp PUBLIC ${CMAKE_CURRENT_LIST_DIR})
+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 ${CMAKE_CURRENT_BINARY_DIR}/natpmpc DESTINATION bin)
+
add_executable(testgetgateway
testgetgateway.c
getgateway.c)
target_link_libraries(testgetgateway natpmp)
+
+install(FILES natpmp.h DESTINATION include)
+install(FILES natpmp_declspec.h DESTINATION include)