chore: Upgrade to C++20 in CMake build.

We need at least C++14 for `std::make_unique`, and would like to use
C++20 for designated initialisers to construct Network/Random vtables.
This commit is contained in:
iphydf 2022-04-07 19:57:05 +00:00
parent f68b1412b4
commit e3fd8922a4
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9

View File

@ -82,12 +82,12 @@ set(CMAKE_MACOSX_RPATH ON)
if(${CMAKE_VERSION} VERSION_LESS "3.1.0")
if(NOT MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")
endif()
else()
# Set standard version for compiler.
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_EXTENSIONS OFF)