file: use blob_buf_free()
[project/rpcd.git] / CMakeLists.txt
index cbdf743..f1e283d 100644 (file)
@@ -1,10 +1,12 @@
 cmake_minimum_required(VERSION 2.6)
 
+INCLUDE(CheckFunctionExists)
+
 PROJECT(rpcd C)
-ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations -Iinclude)
+ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations)
+INCLUDE_DIRECTORIES(include)
 
 OPTION(FILE_SUPPORT "File plugin support" ON)
-OPTION(LUCI2_SUPPORT "LuCI2 plugin support" ON)
 OPTION(IWINFO_SUPPORT "libiwinfo plugin support" ON)
 
 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
@@ -14,10 +16,19 @@ IF(APPLE)
   LINK_DIRECTORIES(/opt/local/lib)
 ENDIF()
 
+CHECK_FUNCTION_EXISTS(getspnam HAVE_SHADOW)
+IF(HAVE_SHADOW)
+  ADD_DEFINITIONS(-DHAVE_SHADOW)
+ENDIF()
+
 FIND_LIBRARY(json NAMES json-c json)
+FIND_LIBRARY(crypt NAMES crypt)
+IF(crypt STREQUAL "crypt-NOTFOUND")
+  SET(crypt "")
+ENDIF()
 
 ADD_EXECUTABLE(rpcd main.c exec.c session.c uci.c plugin.c)
-TARGET_LINK_LIBRARIES(rpcd ubox ubus uci dl blobmsg_json ${json})
+TARGET_LINK_LIBRARIES(rpcd ubox ubus uci dl blobmsg_json ${json} ${crypt})
 
 SET(PLUGINS "")
 
@@ -28,13 +39,6 @@ IF(FILE_SUPPORT)
   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()
-
 IF (IWINFO_SUPPORT)
   SET(PLUGINS ${PLUGINS} iwinfo_plugin)
   ADD_LIBRARY(iwinfo_plugin MODULE iwinfo.c)