diff options
author | Raul Tambre <raul@tambre.ee> | 2023-08-15 06:08:21 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-08-15 13:43:48 (GMT) |
commit | 65288eb92a4f0753340df11acb55134d603663d1 (patch) | |
tree | e49e6b1b728ef1a0551aa40ae04f7c6ca4032223 | |
parent | f3d9a8211042c3df043d886f2217a705a62168a8 (diff) | |
download | CMake-65288eb92a4f0753340df11acb55134d603663d1.zip CMake-65288eb92a4f0753340df11acb55134d603663d1.tar.gz CMake-65288eb92a4f0753340df11acb55134d603663d1.tar.bz2 |
Clang: use -std=c23 for Clang 18+
Canonical flag changed in LLVM commit 13629b140801870feff855ca168edf6b34dbef8d.
-rw-r--r-- | Modules/Compiler/Clang-C.cmake | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index 1b765ad..480a5de 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -48,7 +48,10 @@ if("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") set(CMAKE_C17_EXTENSION_COMPILE_OPTION "-std=gnu17") endif() - if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0) + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 18.0) + set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c23") + set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu23") + elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0) set(CMAKE_C23_STANDARD_COMPILE_OPTION "-std=c2x") set(CMAKE_C23_EXTENSION_COMPILE_OPTION "-std=gnu2x") endif() |