From 10f6514c55f6ed5971af1b9e1d34b19b70f372df Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Wed, 16 Apr 2025 21:06:27 -0400 Subject: [PATCH] automatically enable SSL support if we detect libssl-dev; --- CMakeLists.txt | 10 ---------- src/CompilerOptions.cmake | 22 +++++++++++++++------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b07ab26d..13b81907 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,14 +27,6 @@ else () message(CHECK_PASS "no") endif (ENABLE_TUI_SUPPORT) -option(ENABLE_SSL "Enable SSL support" off) -message(CHECK_START "Enable SSL support") -if (ENABLE_SSL) - message(CHECK_PASS "yes") -else () - message(CHECK_PASS "no") -endif (ENABLE_SSL) - option(DISABLE_WEBSOCKETS "Disable WebSocket support" off) if (DISABLE_WEBSOCKETS) message(CHECK_START "Disable WebSocket support - enabled") @@ -54,8 +46,6 @@ if (COMPILE_WIN32) # No TUI for this set(ENABLE_TUI_SUPPORT OFF) message(CHECK_START "Enable TUI support - no; for simplicity WIN32 does not support TUI.") - set(ENABLE_SSL OFF) - message(CHECK_START "Enable SSL support - no; for simplicity WIN32 does not support SSL.") else() set(CMAKE_C_COMPILER /usr/bin/gcc CACHE STRING "C compiler") set(CMAKE_CXX_COMPILER /usr/bin/g++ CACHE STRING "C++ compiler") diff --git a/src/CompilerOptions.cmake b/src/CompilerOptions.cmake index 7103d2a0..0fad339c 100644 --- a/src/CompilerOptions.cmake +++ b/src/CompilerOptions.cmake @@ -17,10 +17,6 @@ else() set(ENABLE_SETUP_TUI off) endif (ENABLE_TUI_SUPPORT) -if (ENABLE_SSL) - add_definitions(-DENABLE_SSL) -endif (ENABLE_SSL) - option(DISABLE_TUI_APPS "Disable extra TUI applications" off) if (DISABLE_TUI_APPS) message(CHECK_START "Disable extra TUI applications - enabled") @@ -172,7 +168,19 @@ if (HAVE_SENDMMSG) endif (HAVE_SENDMMSG) # are we enabling SSL support? -if (ENABLE_SSL) +if (NOT COMPILE_WIN32) find_package(OpenSSL REQUIRED) - include_directories("${OPENSSL_INCLUDE_DIR}") -endif (ENABLE_SSL) + if (OpenSSL_FOUND) + message(STATUS "OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}") + message(STATUS "OpenSSL libraries: ${OPENSSL_LIBRARIES}") + message(CHECK_START "Enable SSL support") + message(CHECK_PASS "yes") + + add_definitions(-DENABLE_SSL) + include_directories("${OPENSSL_INCLUDE_DIR}") + else (OpenSSL_FOUND) + message(STATUS "OpenSSL not found, SSL support disabled") + message(CHECK_START "Enable SSL support") + message(CHECK_PASS "no") + endif (OpenSSL_FOUND) +endif (NOT COMPILE_WIN32)