1 cmake_minimum_required(VERSION 2.8.9)
2 include(CheckCSourceCompiles)
4 set(SAMP lws-minimal-ws-client-pmd-bulk)
5 set(SRCS minimal-ws-client-pmd-bulk.c)
7 # If we are being built as part of lws, confirm current build config supports
8 # reqconfig, else skip building ourselves.
10 # If we are being built externally, confirm installed lws was configured to
11 # support reqconfig, else error out with a helpful message about the problem.
13 MACRO(require_lws_config reqconfig _val result)
15 if (DEFINED ${reqconfig})
25 if (${_val} EQUAL ${rq})
31 if (LWS_WITH_MINIMAL_EXAMPLES AND NOT ${SAME})
33 message("${SAMP}: skipping as lws being built without ${reqconfig}")
35 message("${SAMP}: skipping as lws built with ${reqconfig}")
39 if (LWS_WITH_MINIMAL_EXAMPLES)
42 CHECK_C_SOURCE_COMPILES("#include <libwebsockets.h>\nint main(void) {\n#if defined(${reqconfig})\n return 0;\n#else\n fail;\n#endif\n return 0;\n}\n" HAS_${reqconfig})
43 if (NOT DEFINED HAS_${reqconfig} OR NOT HAS_${reqconfig})
44 set(HAS_${reqconfig} 0)
46 set(HAS_${reqconfig} 1)
48 if ((HAS_${reqconfig} AND ${_val}) OR (NOT HAS_${reqconfig} AND NOT ${_val}))
56 message(FATAL_ERROR "This project requires lws must have been configured with ${reqconfig}")
58 message(FATAL_ERROR "Lws configuration of ${reqconfig} is incompatible with this project")
66 require_lws_config(LWS_ROLE_WS 1 requirements)
67 require_lws_config(LWS_WITHOUT_CLIENT 0 requirements)
68 #require_lws_config(LWS_WITHOUT_EXTENSIONS 0 requirements)
71 add_executable(${SAMP} ${SRCS})
73 if (websockets_shared)
74 target_link_libraries(${SAMP} websockets_shared)
75 add_dependencies(${SAMP} websockets_shared)
77 target_link_libraries(${SAMP} websockets)