summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/Clang-C.cmake
diff options
context:
space:
mode:
authorRuben Van Boxem <vanboxem.ruben@gmail.com>2017-06-17 22:39:09 (GMT)
committerBrad King <brad.king@kitware.com>2017-06-27 17:04:41 (GMT)
commitc67bb5bae386b323746c6d471a25272e9e497792 (patch)
tree0f2f336a92bc1f9209fd153e4b32fbb41e37b064 /Modules/Compiler/Clang-C.cmake
parent1363a0cbcef00cb9a49eba3b68283b5b6d1b95a5 (diff)
downloadCMake-c67bb5bae386b323746c6d471a25272e9e497792.zip
CMake-c67bb5bae386b323746c6d471a25272e9e497792.tar.gz
CMake-c67bb5bae386b323746c6d471a25272e9e497792.tar.bz2
Clang: Do not add '-std=' options when simulating MSVC
The `cl.exe` style command line does not accept the `-std=` options. Instead behave like MSVC where we don't define standard levels. Fixes: #16266
Diffstat (limited to 'Modules/Compiler/Clang-C.cmake')
-rw-r--r--Modules/Compiler/Clang-C.cmake30
1 files changed, 23 insertions, 7 deletions
diff --git a/Modules/Compiler/Clang-C.cmake b/Modules/Compiler/Clang-C.cmake
index b881e2b..a5f9d84 100644
--- a/Modules/Compiler/Clang-C.cmake
+++ b/Modules/Compiler/Clang-C.cmake
@@ -7,14 +7,30 @@ if(WIN32 OR (APPLE AND NOT appleClangPolicy STREQUAL NEW))
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4)
- set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c90")
- set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu90")
+ if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
+ 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")
+ set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99")
+ set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99")
- set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11")
- set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11")
+ 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 "")
+
+ 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()
endif()
-__compiler_check_default_language_standard(C 3.4 99 3.6 11)
+if(NOT "x${CMAKE_C_SIMULATE_ID}" STREQUAL "xMSVC")
+ __compiler_check_default_language_standard(C 3.4 99 3.6 11)
+else()
+ set(CMAKE_C_STANDARD_DEFAULT "")
+endif()