Files
yourchat/CMakeLists.txt
Torsten Schulz (local) d619d70a76 Füge Unterstützung für SSL/TLS in die Konfiguration und das Build-System ein
- Integriere die libwebsockets-Bibliothek für SSL/TLS WebSocket-Unterstützung in `CMakeLists.txt`.
- Aktualisiere `chatconfig.json`, um SSL-Optionen wie `ssl_enabled`, `ssl_cert_path` und `ssl_key_path` hinzuzufügen.
- Ergänze das `deploy.sh`-Skript um einen Schritt zur optionalen Einrichtung von SSL/TLS.
- Modifiziere `update_config.sh`, um die SSL-Konfiguration in die Servereinstellungen zu integrieren.
- Implementiere eine Überprüfung in `main.cpp`, um den SSL-Status zu prüfen und entsprechende Meldungen auszugeben.
2025-09-04 12:05:22 +02:00

51 lines
1.7 KiB
CMake

cmake_minimum_required(VERSION 3.10)
project(YourChat VERSION 0.1)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True)
include_directories(${PROJECT_SOURCE_DIR}/src)
# Option to enable debug logging (guards [Debug] prints)
option(YC_DEBUG "Enable YourChat debug logging" OFF)
message(STATUS "YC_DEBUG option: ${YC_DEBUG}")
add_executable(yourchat
src/main.cpp
src/lib/base.cpp
src/core/config.cpp
src/core/server.cpp
src/core/chat_room.cpp
src/lib/tools.cpp
src/core/chat_user.cpp
src/lib/database.cpp
src/object/user.cpp
src/object/room.cpp
)
target_link_libraries(yourchat jsoncpp pthread pqxx)
if(YC_DEBUG)
message(STATUS "YC_DEBUG enabled: defining YC_DEBUG=1, enabling Debug build and verbose makefiles")
# Ensure Debug build type for better symbols/optimizations settings
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type" FORCE)
# Show full compile/link commands to verify -DYC_DEBUG in use
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "Verbose Makefile" FORCE)
# Export compile_commands.json for tooling
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Export compile_commands.json" FORCE)
target_compile_definitions(yourchat PRIVATE YC_DEBUG=1)
endif()
# Link OpenSSL for WebSocket handshake helpers
find_package(OpenSSL REQUIRED)
target_link_libraries(yourchat OpenSSL::SSL OpenSSL::Crypto)
# Link libwebsockets for SSL/TLS WebSocket support
find_package(PkgConfig REQUIRED)
pkg_check_modules(LWS REQUIRED libwebsockets)
target_include_directories(yourchat PRIVATE ${LWS_INCLUDE_DIRS})
target_link_libraries(yourchat ${LWS_LIBRARIES})
add_executable(ws_probe tools/ws_probe.cpp)
target_compile_features(ws_probe PRIVATE cxx_std_17)
target_link_libraries(ws_probe pthread)