]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Allow C17 for newer CMake versions (#1958)
authorAlexander Vieth <vieth.alexander@gmx.net>
Thu, 11 Sep 2025 10:27:49 +0000 (12:27 +0200)
committerGitHub <noreply@github.com>
Thu, 11 Sep 2025 10:27:49 +0000 (12:27 +0200)
.github/workflows/cmake.yml
CMakeLists.txt

index a5bf8f2d92b48fd29bbb12f8c679ae0a462cd1bc..5408f897e5d4fab8bcaf400965238a7b99e0e3fc 100644 (file)
@@ -86,6 +86,18 @@ jobs:
             packages: gcc-multilib g++-multilib
             codecov: ubuntu_gcc_m32
 
+          - name: Ubuntu GCC C17
+            os: ubuntu-latest
+            compiler: gcc
+            cxx-compiler: g++
+            cmake-args: -DCMAKE_C_STANDARD=17
+
+          - name: Ubuntu GCC C23
+            os: ubuntu-latest
+            compiler: gcc
+            cxx-compiler: g++
+            cmake-args: -DCMAKE_C_STANDARD=23
+
           - name: Ubuntu GCC No Chorba
             os: ubuntu-latest
             compiler: gcc
@@ -422,6 +434,20 @@ jobs:
             gcov-exec: llvm-cov-15 gcov
             codecov: ubuntu_clang
 
+          - name: Ubuntu Clang C17
+            os: ubuntu-latest
+            compiler: clang-15
+            cxx-compiler: clang++-15
+            cmake-args: -DCMAKE_C_STANDARD=17
+            packages: clang-15 llvm-15 llvm-15-tools
+
+          - name: Ubuntu Clang C23
+            os: ubuntu-latest
+            compiler: clang-18
+            cxx-compiler: clang++-18
+            cmake-args: -DCMAKE_C_STANDARD=23
+            packages: clang-18 llvm-18 llvm-18-tools
+
           # Check for undefined symbols in the version script for the modern api
           - name: Ubuntu Clang Undefined Symbols
             os: ubuntu-latest
@@ -515,6 +541,11 @@ jobs:
             compiler: cl
             cmake-args: -G "Visual Studio 17 2022" -A x64 -T v143 -DWITH_NATIVE_INSTRUCTIONS=ON -DNATIVE_ARCH_OVERRIDE=/arch:AVX
 
+          - name: Windows MSVC 2022 v143 Win64 C17
+            os: windows-latest
+            compiler: cl
+            cmake-args: -G "Visual Studio 17 2022" -A x64 -T v143 -DCMAKE_C_STANDARD=17
+
           - name: Windows MSVC 2022 v142 Win32
             os: windows-latest
             compiler: cl
index 3888508915ac9c4c7bf14d96093e58fb03bd07d1..f2d0397988ed318bb96af48bf3d25e974dc0b55b 100644 (file)
@@ -21,6 +21,9 @@ if(NOT DEFINED CMAKE_C_EXTENSIONS)
     set(CMAKE_C_EXTENSIONS OFF)       # Boolean specifying whether compiler specific extensions are requested
 endif()
 set(VALID_C_STANDARDS "99" "11")
+if(CMAKE_VERSION VERSION_GREATER 3.20)
+    list(APPEND VALID_C_STANDARDS "17" "23")
+endif()
 if(NOT CMAKE_C_STANDARD IN_LIST VALID_C_STANDARDS)
     MESSAGE(FATAL_ERROR "CMAKE_C_STANDARD:STRING=${CMAKE_C_STANDARD} not in known standards list\n ${VALID_C_STANDARDS}")
 endif()