bca9764a2cd6d0eba7486f100fa1f4d4f0559511
[platform/upstream/cmake.git] / Modules / Compiler / MSVC-C.cmake
1 # MSVC has no specific options to set C language standards, but set them as
2 # empty strings anyways so the feature test infrastructure can at least check
3 # to see if they are defined.
4 set(CMAKE_C90_STANDARD_COMPILE_OPTION "")
5 set(CMAKE_C90_EXTENSION_COMPILE_OPTION "")
6 set(CMAKE_C99_STANDARD_COMPILE_OPTION "")
7 set(CMAKE_C99_EXTENSION_COMPILE_OPTION "")
8 set(CMAKE_C11_STANDARD_COMPILE_OPTION "")
9 set(CMAKE_C11_EXTENSION_COMPILE_OPTION "")
10
11 # There is no meaningful default for this
12 set(CMAKE_C_STANDARD_DEFAULT "")
13
14 set(CMAKE_C_CLANG_TIDY_DRIVER_MODE "cl")
15
16 # There are no C compiler modes so we hard-code the known compiler supported
17 # features. Override the default macro for this special case.  Pretend that
18 # all language standards are available so that at least compilation
19 # can be attempted.
20 macro(cmake_record_c_compile_features)
21   list(APPEND CMAKE_C_COMPILE_FEATURES
22     c_std_90
23     c_std_99
24     c_std_11
25     c_function_prototypes
26     )
27   list(APPEND CMAKE_C90_COMPILE_FEATURES c_std_90 c_function_prototypes)
28   list(APPEND CMAKE_C99_COMPILE_FEATURES c_std_99)
29   list(APPEND CMAKE_C11_COMPILE_FEATURES c_std_11)
30   if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 14.0)
31     list(APPEND CMAKE_C_COMPILE_FEATURES c_variadic_macros)
32     list(APPEND CMAKE_C99_COMPILE_FEATURES c_variadic_macros)
33   endif()
34   set(_result 0) # expected by cmake_determine_compile_features
35 endmacro()
36
37 # /JMC "Just My Code" is only supported by MSVC 19.05 onward.
38 if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.05)
39   set(CMAKE_C_COMPILE_OPTIONS_JMC "-JMC")
40 endif()