diff --git a/CMakeLists.txt b/CMakeLists.txt index 10b3301f..03842f91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,22 +113,27 @@ else() list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSelectInterruptEventFd.h) endif() -if (WIN32) - set(USE_MBED_TLS TRUE) -endif() +option(USE_TLS "Enable TLS support" FALSE) if (USE_TLS) + if (WIN32) + option(USE_MBED_TLS "Use Mbed TLS" ON) + else() + option(USE_MBED_TLS "Use Mbed TLS" OFF) + endif() + option(USE_OPEN_SSL "Use OpenSSL" OFF) + if (USE_MBED_TLS) list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketMbedTLS.h) list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketMbedTLS.cpp) elseif (APPLE AND NOT USE_OPEN_SSL) list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketAppleSSL.h) list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketAppleSSL.cpp) - elseif (WIN32) + elseif (WIN32 AND NOT USE_OPEN_SSL) list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketSChannel.h) list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketSChannel.cpp) else() - set(USE_OPEN_SSL TRUE) + set(USE_OPEN_SSL ON) list( APPEND IXWEBSOCKET_HEADERS ixwebsocket/IXSocketOpenSSL.h) list( APPEND IXWEBSOCKET_SOURCES ixwebsocket/IXSocketOpenSSL.cpp) endif() @@ -145,14 +150,10 @@ if (USE_TLS) target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_MBED_TLS) elseif (USE_OPEN_SSL) target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_OPEN_SSL) - elseif (APPLE) - elseif (WIN32) - else() - target_compile_definitions(ixwebsocket PUBLIC IXWEBSOCKET_USE_OPEN_SSL) endif() endif() -if (APPLE AND USE_TLS AND NOT USE_MBED_TLS) +if (APPLE AND USE_TLS AND NOT USE_MBED_TLS AND NOT USE_OPEN_SSL) target_link_libraries(ixwebsocket "-framework foundation" "-framework security") endif() @@ -207,7 +208,7 @@ else() endif() set( IXWEBSOCKET_INCLUDE_DIRS - . + ${CMAKE_CURRENT_SOURCE_DIR} ) if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")