Parcourir la source

AppleClang: Add flags for C17 and C23

Follow up commit 72f4984cdc (Clang: C23 support, 2021-02-07).
Brad King il y a 4 ans
Parent
commit
b642022046
1 fichiers modifiés avec 11 ajouts et 1 suppressions
  1. 11 1
      Modules/Compiler/AppleClang-C.cmake

+ 11 - 1
Modules/Compiler/AppleClang-C.cmake

@@ -28,4 +28,14 @@ if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0)
   set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON)
 endif()
 
-__compiler_check_default_language_standard(C 4.0 99)
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
+  set(CMAKE_C17_STANDARD_COMPILE_OPTION "-std=c17")
+  set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17")
+endif()
+
+if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0.3)
+  set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x")
+  set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x")
+endif()
+
+__compiler_check_default_language_standard(C 4.0 99 9.1 11 12.0.5 17)