summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/AppleClang-C.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-16 13:55:10 (GMT)
committerBrad King <brad.king@kitware.com>2021-06-16 19:50:55 (GMT)
commitb642022046f8a43adc3f546921a206601e7d427f (patch)
tree7c8e75c4975c84fe1c0a7b77eda8d45b8a2a47da /Modules/Compiler/AppleClang-C.cmake
parent4371a25d1fb67a185b769bac2cfb129301d9e39f (diff)
downloadCMake-b642022046f8a43adc3f546921a206601e7d427f.zip
CMake-b642022046f8a43adc3f546921a206601e7d427f.tar.gz
CMake-b642022046f8a43adc3f546921a206601e7d427f.tar.bz2
AppleClang: Add flags for C17 and C23
Follow up commit 72f4984cdc (Clang: C23 support, 2021-02-07).
Diffstat (limited to 'Modules/Compiler/AppleClang-C.cmake')
-rw-r--r--Modules/Compiler/AppleClang-C.cmake12
1 files changed, 11 insertions, 1 deletions
diff --git a/Modules/Compiler/AppleClang-C.cmake b/Modules/Compiler/AppleClang-C.cmake
index bd98193..d711b6e 100644
--- a/Modules/Compiler/AppleClang-C.cmake
+++ b/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)