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

Sources/uhttpd/CMakeLists.txt

  1 cmake_minimum_required(VERSION 2.6)
  2 
  3 PROJECT(uhttpd C)
  4 
  5 INCLUDE (CheckFunctionExists)
  6 
  7 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
  8 ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -Os -Wall -Werror -Wmissing-declarations --std=gnu99 -g3)
  9 
 10 OPTION(TLS_SUPPORT "TLS support" ON)
 11 OPTION(LUA_SUPPORT "Lua support" ON)
 12 OPTION(UBUS_SUPPORT "ubus support" ON)
 13 
 14 IF(APPLE)
 15   INCLUDE_DIRECTORIES(/opt/local/include)
 16   LINK_DIRECTORIES(/opt/local/lib)
 17 ENDIF()
 18 
 19 FIND_LIBRARY(LIBS crypt)
 20 IF(LIBS STREQUAL "LIBS-NOTFOUND")
 21         SET(LIBS "")
 22 ENDIF()
 23 
 24 FIND_PATH(ubox_include_dir libubox/usock.h)
 25 INCLUDE_DIRECTORIES(${ubox_include_dir})
 26 
 27 SET(SOURCES main.c listen.c client.c utils.c file.c auth.c cgi.c relay.c proc.c plugin.c handler.c)
 28 IF(TLS_SUPPORT)
 29         SET(SOURCES ${SOURCES} tls.c)
 30         ADD_DEFINITIONS(-DHAVE_TLS)
 31 ENDIF()
 32 
 33 CHECK_FUNCTION_EXISTS(getspnam HAVE_SHADOW)
 34 IF(HAVE_SHADOW)
 35     ADD_DEFINITIONS(-DHAVE_SHADOW)
 36 ENDIF()
 37 
 38 ADD_EXECUTABLE(uhttpd ${SOURCES})
 39 FIND_LIBRARY(libjson NAMES json-c json)
 40 TARGET_LINK_LIBRARIES(uhttpd ubox dl json_script blobmsg_json ${libjson} ${LIBS})
 41 
 42 SET(PLUGINS "")
 43 IF(LUA_SUPPORT)
 44         FIND_PROGRAM(PKG_CONFIG pkg-config)
 45 
 46         IF(NOT LUA_CFLAGS AND PKG_CONFIG)
 47                 EXECUTE_PROCESS(
 48                         COMMAND pkg-config --silence-errors --cflags lua5.1
 49                         OUTPUT_VARIABLE LUA_CFLAGS
 50                         OUTPUT_STRIP_TRAILING_WHITESPACE
 51                 )
 52         ENDIF()
 53 
 54         IF(NOT LUA_LIBS AND PKG_CONFIG)
 55                 EXECUTE_PROCESS(
 56                         COMMAND pkg-config --silence-errors --libs lua5.1
 57                         OUTPUT_VARIABLE LUA_LIBS
 58                         OUTPUT_STRIP_TRAILING_WHITESPACE
 59                 )
 60         ENDIF()
 61 
 62         IF(NOT LUA_LIBS)
 63                 SET(LUA_LIBS "lua")
 64         ENDIF()
 65 
 66         SET(PLUGINS ${PLUGINS} uhttpd_lua)
 67         ADD_DEFINITIONS(-DHAVE_LUA ${LUA_CFLAGS})
 68         ADD_LIBRARY(uhttpd_lua MODULE lua.c)
 69         TARGET_LINK_LIBRARIES(uhttpd_lua ${LUA_LIBS} m dl)
 70 ENDIF()
 71 
 72 IF(UBUS_SUPPORT)
 73         SET(PLUGINS ${PLUGINS} uhttpd_ubus)
 74         ADD_DEFINITIONS(-DHAVE_UBUS)
 75         ADD_LIBRARY(uhttpd_ubus MODULE ubus.c)
 76         TARGET_LINK_LIBRARIES(uhttpd_ubus ubus ubox blobmsg_json ${libjson})
 77 ENDIF()
 78 
 79 IF(PLUGINS)
 80         SET_TARGET_PROPERTIES(${PLUGINS} PROPERTIES
 81                 PREFIX ""
 82         )
 83 ENDIF()
 84 
 85 INSTALL(TARGETS uhttpd ${PLUGINS}
 86         RUNTIME DESTINATION bin
 87         LIBRARY DESTINATION lib
 88 )

This page was automatically generated by LXR 0.3.1.  •  OpenWrt