2013-01-26 15:29:09 +01:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
2013-09-02 17:09:57 +02:00
|
|
|
PROJECT(rpcd C)
|
2013-09-04 12:46:11 +02:00
|
|
|
ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations -Iinclude)
|
2013-01-26 15:29:09 +01:00
|
|
|
|
2013-09-02 15:14:33 +02:00
|
|
|
OPTION(FILE_SUPPORT "File plugin support" ON)
|
|
|
|
OPTION(LUCI2_SUPPORT "LuCI2 plugin support" ON)
|
|
|
|
OPTION(IWINFO_SUPPORT "libiwinfo plugin support" ON)
|
|
|
|
|
2013-01-26 15:29:09 +01:00
|
|
|
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
|
|
|
|
|
|
|
IF(APPLE)
|
|
|
|
INCLUDE_DIRECTORIES(/opt/local/include)
|
|
|
|
LINK_DIRECTORIES(/opt/local/lib)
|
|
|
|
ENDIF()
|
|
|
|
|
2013-09-01 22:12:19 +02:00
|
|
|
FIND_LIBRARY(json NAMES json-c json)
|
|
|
|
|
2013-09-02 17:09:57 +02:00
|
|
|
ADD_EXECUTABLE(rpcd main.c exec.c session.c uci.c plugin.c)
|
|
|
|
TARGET_LINK_LIBRARIES(rpcd ubox ubus uci dl blobmsg_json ${json})
|
2013-09-02 15:14:33 +02:00
|
|
|
|
|
|
|
SET(PLUGINS "")
|
|
|
|
|
|
|
|
IF(FILE_SUPPORT)
|
|
|
|
SET(PLUGINS ${PLUGINS} file_plugin)
|
|
|
|
ADD_LIBRARY(file_plugin MODULE file.c)
|
|
|
|
TARGET_LINK_LIBRARIES(file_plugin ubox ubus)
|
|
|
|
SET_TARGET_PROPERTIES(file_plugin PROPERTIES OUTPUT_NAME file PREFIX "")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
IF(LUCI2_SUPPORT)
|
|
|
|
SET(PLUGINS ${PLUGINS} luci2_plugin)
|
|
|
|
ADD_LIBRARY(luci2_plugin MODULE luci2.c)
|
|
|
|
TARGET_LINK_LIBRARIES(luci2_plugin ubox ubus)
|
|
|
|
SET_TARGET_PROPERTIES(luci2_plugin PROPERTIES OUTPUT_NAME luci2 PREFIX "")
|
|
|
|
ENDIF()
|
2013-01-26 15:29:09 +01:00
|
|
|
|
2013-09-02 15:14:33 +02:00
|
|
|
IF (IWINFO_SUPPORT)
|
|
|
|
SET(PLUGINS ${PLUGINS} iwinfo_plugin)
|
|
|
|
ADD_LIBRARY(iwinfo_plugin MODULE iwinfo.c)
|
|
|
|
TARGET_LINK_LIBRARIES(iwinfo_plugin ubox ubus iwinfo)
|
|
|
|
SET_TARGET_PROPERTIES(iwinfo_plugin PROPERTIES OUTPUT_NAME iwinfo PREFIX "")
|
|
|
|
ENDIF()
|
2013-01-26 15:29:09 +01:00
|
|
|
|
2013-09-02 17:09:57 +02:00
|
|
|
INSTALL(TARGETS rpcd ${PLUGINS}
|
2013-01-26 15:29:09 +01:00
|
|
|
RUNTIME DESTINATION sbin
|
2013-09-02 15:14:33 +02:00
|
|
|
LIBRARY DESTINATION lib
|
2013-01-26 15:29:09 +01:00
|
|
|
)
|