set(INCLUDE_DIRS ${ZLIB_INCLUDE_DIR} ${LIBWEBSOCKETS_INCLUDE_DIRS} ${JSON-C_INCLUDE_DIRS} ${LIBUV_INCLUDE_DIRS})
set(LINK_LIBS ${ZLIB_LIBRARIES} ${LIBWEBSOCKETS_LIBRARIES} ${JSON-C_LIBRARIES} ${LIBUV_LIBRARIES})
+set (CMAKE_REQUIRED_INCLUDES ${INCLUDE_DIRS})
+include(CheckSymbolExists)
+check_symbol_exists(LWS_OPENSSL_SUPPORT "lws_config.h" LWS_OPENSSL_ENABLED)
+if(LWS_OPENSSL_ENABLED)
+ find_package(OpenSSL REQUIRED)
+ list(APPEND INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
+ list(APPEND LINK_LIBS ${OPENSSL_LIBRARIES})
+endif()
+
if(WIN32)
list(APPEND LINK_LIBS shell32)
elseif(NOT APPLE)