• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1project(lws-minimal-secure-streams-post 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-post)
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} minimal-secure-streams-post.c)
19
20	find_program(VALGRIND "valgrind")
21
22	if (LWS_CTEST_INTERNET_AVAILABLE)
23		if (VALGRIND)
24			add_test(NAME sspost-warmcat COMMAND
25				${CMAKE_SOURCE_DIR}/scripts/ctest-background.sh
26				post_hcm_srv
27				${VALGRIND} --tool=memcheck
28				$<TARGET_FILE:lws-minimal-secure-streams-post>
29			)
30		else()
31			add_test(NAME sspost-warmcat
32				COMMAND lws-minimal-secure-streams-post)
33		endif()
34		set_tests_properties(sspost-warmcat
35				     PROPERTIES
36				     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/minimal-examples/secure-streams/minimal-secure-streams-post
37				     TIMEOUT 20)
38	endif()
39
40	if (websockets_shared)
41		target_link_libraries(${SAMP} websockets_shared ${LIBWEBSOCKETS_DEP_LIBS})
42		add_dependencies(${SAMP} websockets_shared)
43	else()
44		target_link_libraries(${SAMP} websockets ${LIBWEBSOCKETS_DEP_LIBS})
45	endif()
46
47	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)
48
49	if (HAS_LWS_WITH_SECURE_STREAMS_PROXY_API OR LWS_WITH_SECURE_STREAMS_PROXY_API)
50		add_compile_options(-DLWS_SS_USE_SSPC)
51
52		add_executable(${SAMP}-client minimal-secure-streams-post.c)
53		if (websockets_shared)
54			target_link_libraries(${SAMP}-client websockets_shared ${LIBWEBSOCKETS_DEP_LIBS})
55			add_dependencies(${SAMP}-client websockets_shared)
56		else()
57			target_link_libraries(${SAMP}-client websockets ${LIBWEBSOCKETS_DEP_LIBS})
58		endif()
59	endif()
60
61endif()
62