Update CMakeLists.txt

This commit is contained in:
Vladimir Dubrovin 2026-04-30 18:13:28 +03:00
parent 30bee085e9
commit 289fc04987

View File

@ -105,7 +105,6 @@ if(WIN32)
# MSVC-specific settings # MSVC-specific settings
add_compile_definitions( add_compile_definitions(
MSVC MSVC
WITH_SSL
) )
# Use static runtime library # Use static runtime library
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
@ -123,7 +122,6 @@ if(WIN32)
# clang-cl (Clang with MSVC frontend) # clang-cl (Clang with MSVC frontend)
add_compile_definitions( add_compile_definitions(
MSVC MSVC
WITH_SSL
) )
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
add_compile_options( add_compile_options(
@ -254,14 +252,14 @@ endif()
# OpenSSL # OpenSSL
set(OPENSSL_FOUND FALSE) set(OPENSSL_FOUND FALSE)
if(3PROXY_USE_OPENSSL) if(3PROXY_USE_OPENSSL)
find_package(OpenSSL QUIET) find_package(OpenSSL REQUIRED)
if(OpenSSL_FOUND) if(OpenSSL_FOUND)
set(OPENSSL_FOUND TRUE) set(OPENSSL_FOUND TRUE)
add_compile_definitions(WITH_SSL) add_compile_definitions(WITH_SSL)
message(STATUS "OpenSSL found: ${OPENSSL_VERSION}") message(STATUS "OpenSSL found: ${OPENSSL_VERSION}")
else()
message(STATUS "OpenSSL not found, SSLPlugin will not be built")
endif() endif()
else()
message(STATUS "OpenSSL disabled by user request")
endif() endif()
# PCRE2 # PCRE2
@ -302,6 +300,11 @@ if(NOT ODBC_FOUND)
add_compile_definitions(NOODBC) add_compile_definitions(NOODBC)
endif() endif()
# Set NORADIUS if OpenSSL is not available (RADIUS requires MD5 from OpenSSL)
if(NOT OPENSSL_FOUND)
add_compile_definitions(NORADIUS)
endif()
# Source files for 3proxy core # Source files for 3proxy core
set(3PROXY_CORE_SOURCES set(3PROXY_CORE_SOURCES
src/3proxy.c src/3proxy.c
@ -419,19 +422,17 @@ if(ODBC_FOUND)
endif() endif()
endif() endif()
if(WIN32)
target_link_libraries(3proxy PRIVATE ${WINDOWS_LIBS})
if(OpenSSL_FOUND) if(OpenSSL_FOUND)
target_link_libraries(3proxy PRIVATE OpenSSL::SSL OpenSSL::Crypto) target_link_libraries(3proxy PRIVATE OpenSSL::SSL OpenSSL::Crypto)
endif() endif()
if(WIN32)
target_link_libraries(3proxy PRIVATE ${WINDOWS_LIBS})
if(COMPILER_IS_MSVC AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/3proxy.rc) if(COMPILER_IS_MSVC AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/3proxy.rc)
target_sources(3proxy PRIVATE 3proxy.rc) target_sources(3proxy PRIVATE 3proxy.rc)
endif() endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(3proxy PRIVATE dl) target_link_libraries(3proxy PRIVATE dl)
if(OpenSSL_FOUND)
target_link_libraries(3proxy PRIVATE OpenSSL::SSL OpenSSL::Crypto)
endif()
endif() endif()
# Build 3proxy_crypt utility # Build 3proxy_crypt utility