diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 669291ff..6d43c782 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,10 +12,13 @@ jobs: fail-fast: false matrix: config: + - { compiler: gcc, version: 11, build_type: Debug, cppstd: 17 } - { compiler: gcc, version: 11, build_type: Debug, cppstd: 20 } + - { compiler: gcc, version: 13, build_type: Release, cppstd: 17 } - { compiler: gcc, version: 13, build_type: Release, cppstd: 20 } - { compiler: gcc, version: 13, build_type: Release, cppstd: 20, std_format: OFF } - { compiler: gcc, version: 13, build_type: Release, cppstd: 20, std_format: ON } + - { compiler: clang, version: 15, build_type: Release, cppstd: 17} - { compiler: clang, version: 15, build_type: Debug, cppstd: 20, asan: ON } - { compiler: clang, version: 15, build_type: Release, cppstd: 20, asan: OFF } container: diff --git a/CMakeLists.txt b/CMakeLists.txt index 1986513e..51371a0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,13 @@ endif() # --------------------------------------------------------------------------------------- # Compiler config # --------------------------------------------------------------------------------------- -set(CMAKE_CXX_STANDARD 20) + +# c++ standard >=17 is required +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) +elseif(CMAKE_CXX_STANDARD LESS 17) + message(FATAL_ERROR "Minimum supported CMAKE_CXX_STANDARD is 17, but CMAKE_CXX_STANDARD is set to a lower value.") +endif() set(CMAKE_CXX_STANDARD_REQUIRED ON) # make sure __cplusplus is defined when using msvc and enable parallel build diff --git a/appveyor.yml b/appveyor.yml index 23e1676a..ea7321c0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,7 +9,7 @@ environment: WCHAR_FILES: 'OFF' BUILD_EXAMPLE: 'ON' USE_STD_FORMAT: 'OFF' - CXX_STANDARD: 11 + CXX_STANDARD: 17 - GENERATOR: '"Visual Studio 15 2017 Win64"' BUILD_TYPE: Release BUILD_SHARED: 'OFF' @@ -17,7 +17,7 @@ environment: WCHAR_FILES: 'OFF' BUILD_EXAMPLE: 'ON' USE_STD_FORMAT: 'OFF' - CXX_STANDARD: 11 + CXX_STANDARD: 17 - GENERATOR: '"Visual Studio 15 2017 Win64"' BUILD_TYPE: Release BUILD_SHARED: 'ON' @@ -25,7 +25,7 @@ environment: WCHAR_FILES: 'OFF' BUILD_EXAMPLE: 'ON' USE_STD_FORMAT: 'OFF' - CXX_STANDARD: 11 + CXX_STANDARD: 17 - GENERATOR: '"Visual Studio 15 2017 Win64"' BUILD_TYPE: Release BUILD_SHARED: 'ON' @@ -33,7 +33,7 @@ environment: WCHAR_FILES: 'ON' BUILD_EXAMPLE: 'OFF' USE_STD_FORMAT: 'OFF' - CXX_STANDARD: 11 + CXX_STANDARD: 17 - GENERATOR: '"Visual Studio 16 2019" -A x64' BUILD_TYPE: Release BUILD_SHARED: 'ON'