build static library
authorFelix Fietkau <nbd@nbd.name>
Mon, 23 May 2022 17:33:59 +0000 (19:33 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 23 May 2022 17:56:27 +0000 (19:56 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
CMakeLists.txt

index 581015cbbd250a84820d393d4ef5a598f45ef768..c780c96ec9495ee2b4f057cdcd0631314d21c530 100644 (file)
@@ -8,7 +8,7 @@ INCLUDE_DIRECTORIES(include)
 ADD_DEFINITIONS(-Wall -Werror -Wextra -Wno-unused-parameter)
 STRING(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
 
-ADD_LIBRARY(nl-tiny SHARED
+SET(SOURCES
        attr.c
        cache.c
        cache_mngt.c
@@ -24,6 +24,9 @@ ADD_LIBRARY(nl-tiny SHARED
        socket.c
        unl.c
 )
+ADD_LIBRARY(nl-tiny SHARED ${SOURCES})
+ADD_LIBRARY(nl-tiny-static STATIC ${SOURCES})
+SET_TARGET_PROPERTIES(nl-tiny-static PROPERTIES OUTPUT_NAME nl-tiny)
 
 CONFIGURE_FILE(
        "${CMAKE_CURRENT_SOURCE_DIR}/libnl-tiny.pc.in"
@@ -31,7 +34,7 @@ CONFIGURE_FILE(
        @ONLY
 )
 
-INSTALL(TARGETS nl-tiny LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+INSTALL(TARGETS nl-tiny nl-tiny-static LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
 INSTALL(FILES ${CMAKE_BINARY_DIR}/libnl-tiny.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
 INSTALL(
        DIRECTORY ${CMAKE_SOURCE_DIR}/include/