1 cmake_minimum_required(VERSION 2.8)
2 include(CheckCSourceCompiles)
4 set(SAMP lws-minimal-raw-proxy-fallback)
5 set(SRCS minimal-raw-proxy-fallback.c)
7 # NOTE... if you are building this standalone, you must point LWS_PLUGINS_DIR
8 # to the lws plugins dir so it can pick up the plugin source. Eg,
9 # cmake . -DLWS_PLUGINS_DIR=~/libwebsockets/plugins
11 # If we are being built as part of lws, confirm current build config supports
12 # reqconfig, else skip building ourselves.
14 # If we are being built externally, confirm installed lws was configured to
15 # support reqconfig, else error out with a helpful message about the problem.
17 MACRO(require_lws_config reqconfig _val result)
19 if (DEFINED ${reqconfig})
29 if (${_val} EQUAL ${rq})
35 if (LWS_WITH_MINIMAL_EXAMPLES AND NOT ${SAME})
37 message("${SAMP}: skipping as lws being built without ${reqconfig}")
39 message("${SAMP}: skipping as lws built with ${reqconfig}")
43 if (LWS_WITH_MINIMAL_EXAMPLES)
46 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})
47 if (NOT DEFINED HAS_${reqconfig} OR NOT HAS_${reqconfig})
48 set(HAS_${reqconfig} 0)
50 set(HAS_${reqconfig} 1)
52 if ((HAS_${reqconfig} AND ${_val}) OR (NOT HAS_${reqconfig} AND NOT ${_val}))
60 message(FATAL_ERROR "This project requires lws must have been configured with ${reqconfig}")
62 message(FATAL_ERROR "Lws configuration of ${reqconfig} is incompatible with this project")
69 require_lws_config(LWS_ROLE_RAW_PROXY 1 requirements)
72 add_executable(${SAMP} ${SRCS})
75 include_directories(${LWS_PLUGINS_DIR})
78 if (websockets_shared)
79 target_link_libraries(${SAMP} websockets_shared)
80 add_dependencies(${SAMP} websockets_shared)
82 target_link_libraries(${SAMP} websockets)