summaryrefslogtreecommitdiffstats
path: root/Modules/Compiler/MSVC-C.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-03-28 14:56:58 (GMT)
committerBrad King <brad.king@kitware.com>2018-03-29 14:40:13 (GMT)
commita53cf69022e57d859864d59b9c03238f180cb400 (patch)
treeccdf77c39e894283afbeba71eeaf8e3dd78f4bfa /Modules/Compiler/MSVC-C.cmake
parente62dfeccb1bb6a86a85f34908343a89f6d02ee6a (diff)
downloadCMake-a53cf69022e57d859864d59b9c03238f180cb400.zip
CMake-a53cf69022e57d859864d59b9c03238f180cb400.tar.gz
CMake-a53cf69022e57d859864d59b9c03238f180cb400.tar.bz2
Features: Record C features for MSVC
The MSVC C compiler has no notion of C language standards or flags. Tell CMake to assume that all language standards are available. Record available C language features depending on the version of the compiler. Fixes: #17858
Diffstat (limited to 'Modules/Compiler/MSVC-C.cmake')
-rw-r--r--Modules/Compiler/MSVC-C.cmake25
1 files changed, 25 insertions, 0 deletions
diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake
new file mode 100644
index 0000000..22c34f8
--- /dev/null
+++ b/Modules/Compiler/MSVC-C.cmake
@@ -0,0 +1,25 @@
+# MSVC has no specific options to set C language standards, but set them as
+# empty strings anyways so the feature test infrastructure can at least check
+# to see if they are defined.
+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 "")
+
+# There is no meaningful default for this
+set(CMAKE_C_STANDARD_DEFAULT "")
+
+# There are no C compiler modes so we only need to test features once.
+# Override the default macro for this special case. Pretend that
+# all language standards are available so that at least compilation
+# can be attempted.
+macro(cmake_record_c_compile_features)
+ list(APPEND CMAKE_C_COMPILE_FEATURES
+ c_std_90
+ c_std_99
+ c_std_11
+ )
+ _record_compiler_features(C "" CMAKE_C_COMPILE_FEATURES)
+endmacro()