blob: add uci<->blob conversion library code
[project/uci.git] / CMakeLists.txt
index 0857d4e..e846ceb 100644 (file)
@@ -2,43 +2,39 @@ cmake_minimum_required(VERSION 2.6)
 
 PROJECT(uci C)
 
-SET(CMAKE_INSTALL_PREFIX /usr)
+SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
+ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -I. -DUCI_PREFIX="${CMAKE_INSTALL_PREFIX}")
 
-ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -DUCI_PREFIX="${CMAKE_INSTALL_PREFIX}")
-
-OPTION(UCI_PLUGIN_SUPPORT "plugin support" ON)
 OPTION(UCI_DEBUG "debugging support" OFF)
 OPTION(UCI_DEBUG_TYPECAST "typecast debugging support" OFF)
-OPTION(BUILD_LUA "build Lua plugin" ON)
+OPTION(BUILD_LUA "build Lua binding" ON)
 
 CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/uci_config.h.in ${CMAKE_SOURCE_DIR}/uci_config.h )
 
-SET(LIB_SOURCES libuci.c file.c ucimap.c util.c delta.c)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
 
-ADD_LIBRARY(uci-shared SHARED ${LIB_SOURCES})
-SET_TARGET_PROPERTIES(uci-shared PROPERTIES OUTPUT_NAME uci)
+SET(LIB_SOURCES libuci.c file.c util.c delta.c parse.c blob.c)
 
-ADD_LIBRARY(uci-static STATIC ${LIB_SOURCES})
-SET_TARGET_PROPERTIES(uci-static PROPERTIES OUTPUT_NAME uci)
+ADD_LIBRARY(uci SHARED ${LIB_SOURCES})
+TARGET_LINK_LIBRARIES(uci ubox)
+SET_TARGET_PROPERTIES(uci PROPERTIES OUTPUT_NAME uci)
 
 ADD_EXECUTABLE(cli cli.c)
 SET_TARGET_PROPERTIES(cli PROPERTIES OUTPUT_NAME uci)
-TARGET_LINK_LIBRARIES(cli uci-shared)
+TARGET_LINK_LIBRARIES(cli uci)
 
-ADD_EXECUTABLE(cli-static cli.c)
-SET_TARGET_PROPERTIES(cli-static PROPERTIES OUTPUT_NAME uci-static)
-TARGET_LINK_LIBRARIES(cli-static uci-static)
+ADD_LIBRARY(ucimap STATIC ucimap.c)
 
 ADD_EXECUTABLE(ucimap-example ucimap-example.c)
-TARGET_LINK_LIBRARIES(ucimap-example uci-static)
+TARGET_LINK_LIBRARIES(ucimap-example uci ucimap)
 
 ADD_SUBDIRECTORY(lua)
 
-INSTALL(FILES uci.h uci_config.h ucimap.h
-       DESTINATION include/libubox
+INSTALL(FILES uci.h uci_config.h uci_blob.h ucimap.h
+       DESTINATION include
 )
 
-INSTALL(TARGETS uci-shared uci-static cli cli-static
+INSTALL(TARGETS uci cli
        ARCHIVE DESTINATION lib
        LIBRARY DESTINATION lib
        RUNTIME DESTINATION bin