• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/rpcd/CMakeLists.txt

  1 cmake_minimum_required(VERSION 2.6)
  2 
  3 INCLUDE(CheckFunctionExists)
  4 
  5 PROJECT(rpcd C)
  6 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations)
  7 INCLUDE_DIRECTORIES(include)
  8 
  9 OPTION(FILE_SUPPORT "File plugin support" ON)
 10 OPTION(IWINFO_SUPPORT "libiwinfo plugin support" ON)
 11 OPTION(RPCSYS_SUPPORT "rpc-sys plugin support" ON)
 12 
 13 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
 14 
 15 IF(APPLE)
 16   INCLUDE_DIRECTORIES(/opt/local/include)
 17   LINK_DIRECTORIES(/opt/local/lib)
 18 ENDIF()
 19 
 20 CHECK_FUNCTION_EXISTS(getspnam HAVE_SHADOW)
 21 IF(HAVE_SHADOW)
 22   ADD_DEFINITIONS(-DHAVE_SHADOW)
 23 ENDIF()
 24 
 25 FIND_LIBRARY(uci NAMES uci)
 26 FIND_LIBRARY(ubus NAMES ubus)
 27 FIND_LIBRARY(ubox NAMES ubox)
 28 FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
 29 FIND_LIBRARY(json NAMES json-c json)
 30 FIND_LIBRARY(crypt NAMES crypt)
 31 IF(crypt STREQUAL "crypt-NOTFOUND")
 32   SET(crypt "")
 33 ENDIF()
 34 
 35 FIND_PATH(ubus_include_dir libubus.h)
 36 INCLUDE_DIRECTORIES(${ubus_include_dir})
 37 
 38 FIND_PATH(ubox_include_dir libubox/blobmsg_json.h)
 39 INCLUDE_DIRECTORIES(${ubox_include_dir})
 40 
 41 ADD_EXECUTABLE(rpcd main.c exec.c session.c uci.c plugin.c)
 42 TARGET_LINK_LIBRARIES(rpcd ${ubox} ${ubus} ${uci} ${blobmsg_json} ${json} ${crypt} dl)
 43 
 44 SET(PLUGINS "")
 45 
 46 IF(FILE_SUPPORT)
 47   SET(PLUGINS ${PLUGINS} file_plugin)
 48   ADD_LIBRARY(file_plugin MODULE file.c)
 49   TARGET_LINK_LIBRARIES(file_plugin ${ubox} ${ubus})
 50   SET_TARGET_PROPERTIES(file_plugin PROPERTIES OUTPUT_NAME file PREFIX "")
 51 ENDIF()
 52 
 53 IF(RPCSYS_SUPPORT)
 54   SET(PLUGINS ${PLUGINS} rpcsys_plugin)
 55   ADD_LIBRARY(rpcsys_plugin MODULE sys.c)
 56   TARGET_LINK_LIBRARIES(rpcsys_plugin ${ubox} ${ubus})
 57   SET_TARGET_PROPERTIES(rpcsys_plugin PROPERTIES OUTPUT_NAME rpcsys PREFIX "")
 58 ENDIF()
 59 
 60 IF (IWINFO_SUPPORT)
 61   FIND_LIBRARY(iwinfo NAMES iwinfo)
 62   SET(PLUGINS ${PLUGINS} iwinfo_plugin)
 63   ADD_LIBRARY(iwinfo_plugin MODULE iwinfo.c)
 64   TARGET_LINK_LIBRARIES(iwinfo_plugin ${ubox} ${ubus} ${iwinfo})
 65   SET_TARGET_PROPERTIES(iwinfo_plugin PROPERTIES OUTPUT_NAME iwinfo PREFIX "")
 66 ENDIF()
 67 
 68 INSTALL(TARGETS rpcd ${PLUGINS}
 69         RUNTIME DESTINATION sbin
 70         LIBRARY DESTINATION lib
 71 )

This page was automatically generated by LXR 0.3.1.  •  OpenWrt