1 cmake_minimum_required(VERSION 2.6)
3 INCLUDE(CheckFunctionExists)
6 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations -Iinclude)
8 OPTION(FILE_SUPPORT "File plugin support" ON)
9 OPTION(IWINFO_SUPPORT "libiwinfo plugin support" ON)
11 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
14 INCLUDE_DIRECTORIES(/opt/local/include)
15 LINK_DIRECTORIES(/opt/local/lib)
18 CHECK_FUNCTION_EXISTS(getspnam HAVE_SHADOW)
20 ADD_DEFINITIONS(-DHAVE_SHADOW)
23 FIND_LIBRARY(json NAMES json-c json)
24 FIND_LIBRARY(crypt NAMES crypt)
25 IF(crypt STREQUAL "LIBS-NOTFOUND")
29 ADD_EXECUTABLE(rpcd main.c exec.c session.c uci.c plugin.c)
30 TARGET_LINK_LIBRARIES(rpcd ubox ubus uci dl blobmsg_json ${json} ${crypt})
35 SET(PLUGINS ${PLUGINS} file_plugin)
36 ADD_LIBRARY(file_plugin MODULE file.c)
37 TARGET_LINK_LIBRARIES(file_plugin ubox ubus)
38 SET_TARGET_PROPERTIES(file_plugin PROPERTIES OUTPUT_NAME file PREFIX "")
42 SET(PLUGINS ${PLUGINS} iwinfo_plugin)
43 ADD_LIBRARY(iwinfo_plugin MODULE iwinfo.c)
44 TARGET_LINK_LIBRARIES(iwinfo_plugin ubox ubus iwinfo)
45 SET_TARGET_PROPERTIES(iwinfo_plugin PROPERTIES OUTPUT_NAME iwinfo PREFIX "")
48 INSTALL(TARGETS rpcd ${PLUGINS}
49 RUNTIME DESTINATION sbin
50 LIBRARY DESTINATION lib