diff options
-rw-r--r-- | Modules/Compiler/Clang-C.cmake | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake index e905909..220e009 100644 --- a/Modules/Compiler/Clang-C.cmake +++ b/Modules/Compiler/Clang-C.cmake @@ -25,31 +25,38 @@ elseif("x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xGNU") endif() endif() -if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) - set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) - set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) - set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) - - if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") +if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2.1) set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90") set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") + endif() + if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.1) set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") - else() - # clang-cl doesn't have any of these - set(CMAKE_C90_STANDARD_COMPILE_OPTION "") - set(CMAKE_C90_EXTENSION_COMPILE_OPTION "") + elseif(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.0) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c1x") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu1x") + endif() +else() + set(CMAKE_C90_STANDARD_COMPILE_OPTION "") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "") + set(CMAKE_C99_STANDARD_COMPILE_OPTION "") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "") + set(CMAKE_C11_STANDARD_COMPILE_OPTION "") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "") +endif() - set(CMAKE_C99_STANDARD_COMPILE_OPTION "") - set(CMAKE_C99_EXTENSION_COMPILE_OPTION "") +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 2.1) + set(CMAKE_C90_STANDARD__HAS_FULL_SUPPORT ON) + set(CMAKE_C99_STANDARD__HAS_FULL_SUPPORT ON) +endif() - set(CMAKE_C11_STANDARD_COMPILE_OPTION "") - set(CMAKE_C11_EXTENSION_COMPILE_OPTION "") - endif() +if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.0) + set(CMAKE_C11_STANDARD__HAS_FULL_SUPPORT ON) endif() if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC") |