CMakeLists.txt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. cmake_minimum_required(VERSION 2.6)
  2. PROJECT(uci C)
  3. SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
  4. ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -I. -DUCI_PREFIX="${CMAKE_INSTALL_PREFIX}")
  5. OPTION(UCI_DEBUG "debugging support" OFF)
  6. OPTION(UCI_DEBUG_TYPECAST "typecast debugging support" OFF)
  7. OPTION(BUILD_LUA "build Lua binding" ON)
  8. IF(BUILD_STATIC)
  9. FIND_LIBRARY(ubox_library NAMES ubox.a)
  10. ELSE(BUILD_STATIC)
  11. FIND_LIBRARY(ubox_library NAMES ubox)
  12. ENDIF(BUILD_STATIC)
  13. FIND_PATH(ubox_include_dir libubox/usock.h)
  14. CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/uci_config.h.in ${CMAKE_SOURCE_DIR}/uci_config.h )
  15. INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${ubox_include_dir})
  16. SET(LIB_SOURCES libuci.c file.c util.c delta.c parse.c blob.c)
  17. ADD_LIBRARY(uci SHARED ${LIB_SOURCES})
  18. TARGET_LINK_LIBRARIES(uci ${ubox_library})
  19. SET_TARGET_PROPERTIES(uci PROPERTIES OUTPUT_NAME uci)
  20. ADD_EXECUTABLE(cli cli.c)
  21. SET_TARGET_PROPERTIES(cli PROPERTIES OUTPUT_NAME uci)
  22. TARGET_LINK_LIBRARIES(cli uci)
  23. ADD_LIBRARY(ucimap STATIC ucimap.c)
  24. ADD_SUBDIRECTORY(lua)
  25. INSTALL(FILES uci.h uci_config.h uci_blob.h ucimap.h
  26. DESTINATION include
  27. )
  28. INSTALL(TARGETS uci cli
  29. ARCHIVE DESTINATION lib
  30. LIBRARY DESTINATION lib
  31. RUNTIME DESTINATION bin
  32. )