CMakeLists.txt: requires C++23 standard

CMakeLists.txt: add compiler version checks
adc_netserver.h: add AdcTrivialLogger class (use of 'deduced this'
feature of C++23 standard); AdcGenericNetServer class now has basic
based on std::basic_ostream logging capability
This commit is contained in:
2024-11-11 18:36:54 +03:00
parent afa8d09ade
commit 6acc1f94ba
5 changed files with 143 additions and 20 deletions

View File

@@ -4,10 +4,31 @@ project(ADC LANGUAGES CXX)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# set(CMAKE_BUILD_TYPE Release)
#
# check compiler version to ensure supporting of
# 'deducing this' C++23 feature
#
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14.0)
message(FATAL_ERROR "GCC version must be at least 14.0!")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0)
message(FATAL_ERROR "Clang version must be at least 18.0!")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.32")
message(FATAL_ERROR "MSVC version must be at least 19.32")
endif()
else()
message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang and GCC.")
endif()
set(ADC_COMMON_HEADERS
common/adc_traits.h
@@ -29,7 +50,7 @@ set(ADC_NETWORK_HEADERS
# net/adc_netmsg.h
# net/adc_netmessage.h
net/adc_netproto.h
net/adc_netservice.h
# net/adc_netservice.h
net/adc_endpoint.h
net/adc_netserver.h
net/adc_net_concepts.h