• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1project(lws-minimal-secure-streams-avs 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-secure-streams-avs)
9
10set(requirements 1)
11require_lws_config(LWS_ROLE_H1 1 requirements)
12require_lws_config(LWS_WITHOUT_CLIENT 0 requirements)
13require_lws_config(LWS_WITH_SECURE_STREAMS 1 requirements)
14require_lws_config(LWS_WITH_SECURE_STREAMS_STATIC_POLICY_ONLY 0 requirements)
15require_lws_config(LWS_WITH_SYS_STATE 1 requirements)
16
17if (requirements)
18	add_executable(${SAMP} main.c avs.c)
19
20	if (websockets_shared)
21		target_link_libraries(${SAMP} websockets_shared ${LIBWEBSOCKETS_DEP_LIBS})
22		add_dependencies(${SAMP} websockets_shared)
23	else()
24		target_link_libraries(${SAMP} websockets ${LIBWEBSOCKETS_DEP_LIBS})
25	endif()
26
27	CHECK_C_SOURCE_COMPILES("#include <libwebsockets.h>\nint main(void) {\ni#if defined(LWS_WITH_SECURE_STREAMS_PROXY_API)\n return 0;\n #else\n fail\n #endif\n return 0;\n}\n" HAS_LWS_WITH_SECURE_STREAMS_PROXY_API)
28
29	if (HAS_LWS_WITH_SECURE_STREAMS_PROXY_API OR LWS_WITH_SECURE_STREAMS_PROXY_API)
30		add_compile_options(-DLWS_SS_USE_SSPC)
31
32		add_executable(${SAMP}-client main-client.c avs.c)
33		if (websockets_shared)
34			target_link_libraries(${SAMP}-client websockets_shared ${LIBWEBSOCKETS_DEP_LIBS})
35			add_dependencies(${SAMP}-client websockets_shared)
36		else()
37			target_link_libraries(${SAMP}-client websockets ${LIBWEBSOCKETS_DEP_LIBS})
38		endif()
39	endif()
40
41endif()
42