From b642022046f8a43adc3f546921a206601e7d427f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 16 Jun 2021 09:55:10 -0400 Subject: AppleClang: Add flags for C17 and C23 Follow up commit 72f4984cdc (Clang: C23 support, 2021-02-07). --- Modules/Compiler/AppleClang-C.cmake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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) -- cgit v0.12