refactor ubusd.c into reusable ubusd_library
[project/ubus.git] / CMakeLists.txt
index 866b3ab60168f62e0a48df0783cdb130f43ddcbb..dc6e42847086def93a1758d72041c167435ef00a 100644 (file)
@@ -41,8 +41,9 @@ TARGET_LINK_LIBRARIES(ubus ${ubox_library})
 
 find_library(json NAMES json-c json)
 
-ADD_EXECUTABLE(ubusd ubusd.c ubusd_id.c ubusd_obj.c ubusd_proto.c ubusd_event.c ubusd_acl.c ubusd_monitor.c)
-TARGET_LINK_LIBRARIES(ubusd ${ubox_library} ${blob_library} ${json})
+ADD_LIBRARY(ubusd_library STATIC ubusd.c ubusd_proto.c ubusd_id.c ubusd_obj.c ubusd_event.c ubusd_acl.c ubusd_monitor.c)
+ADD_EXECUTABLE(ubusd ubusd_main.c)
+TARGET_LINK_LIBRARIES(ubusd ubusd_library ${ubox_library} ${blob_library} ${json})
 
 ADD_EXECUTABLE(cli cli.c)
 SET_TARGET_PROPERTIES(cli PROPERTIES OUTPUT_NAME ubus)