• 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 -DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
  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 OPTION(UCODE_SUPPORT "ucode plugin support" ON)
 13 
 14 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
 15 
 16 IF(APPLE)
 17   INCLUDE_DIRECTORIES(/opt/local/include)
 18   LINK_DIRECTORIES(/opt/local/lib)
 19 ENDIF()
 20 
 21 CHECK_FUNCTION_EXISTS(getspnam HAVE_SHADOW)
 22 IF(HAVE_SHADOW)
 23   ADD_DEFINITIONS(-DHAVE_SHADOW)
 24 ENDIF()
 25 
 26 FIND_LIBRARY(uci NAMES uci)
 27 FIND_LIBRARY(ubus NAMES ubus)
 28 FIND_LIBRARY(ubox NAMES ubox)
 29 FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
 30 FIND_LIBRARY(json NAMES json-c json)
 31 FIND_LIBRARY(crypt NAMES crypt)
 32 IF(crypt STREQUAL "crypt-NOTFOUND")
 33   SET(crypt "")
 34 ENDIF()
 35 
 36 FIND_PATH(ubus_include_dir libubus.h)
 37 INCLUDE_DIRECTORIES(${ubus_include_dir})
 38 
 39 FIND_PATH(ubox_include_dir libubox/blobmsg_json.h)
 40 INCLUDE_DIRECTORIES(${ubox_include_dir})
 41 
 42 ADD_EXECUTABLE(rpcd main.c exec.c session.c uci.c rc.c plugin.c)
 43 TARGET_LINK_LIBRARIES(rpcd ${ubox} ${ubus} ${uci} ${blobmsg_json} ${json} ${crypt} dl)
 44 
 45 SET(PLUGINS "")
 46 
 47 IF(FILE_SUPPORT)
 48   SET(PLUGINS ${PLUGINS} file_plugin)
 49   ADD_LIBRARY(file_plugin MODULE file.c)
 50   TARGET_LINK_LIBRARIES(file_plugin ${ubox} ${ubus})
 51   SET_TARGET_PROPERTIES(file_plugin PROPERTIES OUTPUT_NAME file PREFIX "")
 52 ENDIF()
 53 
 54 IF(RPCSYS_SUPPORT)
 55   SET(PLUGINS ${PLUGINS} rpcsys_plugin)
 56   ADD_LIBRARY(rpcsys_plugin MODULE sys.c)
 57   TARGET_LINK_LIBRARIES(rpcsys_plugin ${ubox} ${ubus})
 58   SET_TARGET_PROPERTIES(rpcsys_plugin PROPERTIES OUTPUT_NAME rpcsys PREFIX "")
 59 ENDIF()
 60 
 61 IF(IWINFO_SUPPORT)
 62   FIND_LIBRARY(iwinfo NAMES iwinfo)
 63   SET(PLUGINS ${PLUGINS} iwinfo_plugin)
 64   ADD_LIBRARY(iwinfo_plugin MODULE iwinfo.c)
 65   TARGET_LINK_LIBRARIES(iwinfo_plugin ${ubox} ${ubus} ${iwinfo})
 66   SET_TARGET_PROPERTIES(iwinfo_plugin PROPERTIES OUTPUT_NAME iwinfo PREFIX "")
 67 ENDIF()
 68 
 69 IF(UCODE_SUPPORT)
 70   FIND_LIBRARY(ucode NAMES ucode)
 71   SET(PLUGINS ${PLUGINS} ucode_plugin)
 72   ADD_LIBRARY(ucode_plugin MODULE ucode.c)
 73   TARGET_LINK_LIBRARIES(ucode_plugin ${ucode})
 74   SET_TARGET_PROPERTIES(ucode_plugin PROPERTIES OUTPUT_NAME ucode PREFIX "")
 75 ENDIF()
 76 
 77 INSTALL(TARGETS rpcd ${PLUGINS}
 78         RUNTIME DESTINATION sbin
 79         LIBRARY DESTINATION lib/rpcd
 80 )

This page was automatically generated by LXR 0.3.1.  •  OpenWrt