1project(lws-minimal-http-server-deaddrop C) 2cmake_minimum_required(VERSION 2.8.12) 3find_package(libwebsockets CONFIG REQUIRED) 4list(APPEND CMAKE_MODULE_PATH ${LWS_CMAKE_DIR}) 5include(CheckCSourceCompiles) 6include(LwsCheckRequirements) 7 8set(SAMP lws-minimal-http-server-deaddrop) 9set(SRCS minimal-http-server-deaddrop.c) 10 11# NOTE... if you are building this standalone, you must point LWS_PLUGINS_DIR 12# to the lws plugins dir so it can pick up the plugin source. Eg, 13# cmake . -DLWS_PLUGINS_DIR=~/libwebsockets/plugins 14 15set(requirements 1) 16require_lws_config(LWS_ROLE_H1 1 requirements) 17require_lws_config(LWS_ROLE_WS 1 requirements) 18require_lws_config(LWS_WITH_SERVER 1 requirements) 19require_lws_config(LWS_WITH_HTTP_BASIC_AUTH 1 requirements) 20 21if (requirements AND UNIX) 22 add_executable(${SAMP} ${SRCS}) 23 24 if (LWS_PLUGINS_DIR) 25 include_directories(${LWS_PLUGINS_DIR}) 26 endif() 27 28 if (websockets_shared) 29 target_link_libraries(${SAMP} websockets_shared ${LIBWEBSOCKETS_DEP_LIBS}) 30 add_dependencies(${SAMP} websockets_shared) 31 else() 32 target_link_libraries(${SAMP} websockets ${LIBWEBSOCKETS_DEP_LIBS}) 33 endif() 34endif() 35