diff options
author | Brad King <brad.king@kitware.com> | 2018-04-02 13:59:50 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-04-02 14:00:20 (GMT) |
commit | 5d5e1e691772ecfd9224be0afe33802f8aee3fc3 (patch) | |
tree | bbe53ba8fa22719befa53c357d33f9e7261f45d0 /Modules/Compiler | |
parent | a0b5dade9a494783e7b130e27e1dbc12fa1772c6 (diff) | |
parent | a53cf69022e57d859864d59b9c03238f180cb400 (diff) | |
download | CMake-5d5e1e691772ecfd9224be0afe33802f8aee3fc3.zip CMake-5d5e1e691772ecfd9224be0afe33802f8aee3fc3.tar.gz CMake-5d5e1e691772ecfd9224be0afe33802f8aee3fc3.tar.bz2 |
Merge topic 'features-msvc-c'
a53cf69022 Features: Record C features for MSVC
e62dfeccb1 Features: Do not assume c_restrict support in CompileFeatures test
c22cdf78d7 Features: Fix CompileFeatures test checks for C
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Harry Mallon <hjmallon@gmail.com>
Merge-request: !1897
Diffstat (limited to 'Modules/Compiler')
-rw-r--r-- | Modules/Compiler/MSVC-C-FeatureTests.cmake | 8 | ||||
-rw-r--r-- | Modules/Compiler/MSVC-C.cmake | 25 |
2 files changed, 33 insertions, 0 deletions
diff --git a/Modules/Compiler/MSVC-C-FeatureTests.cmake b/Modules/Compiler/MSVC-C-FeatureTests.cmake new file mode 100644 index 0000000..3f09be2 --- /dev/null +++ b/Modules/Compiler/MSVC-C-FeatureTests.cmake @@ -0,0 +1,8 @@ +set(_cmake_oldestSupported "_MSC_VER >= 1600") + +# Not yet supported: +#set(_cmake_feature_test_c_static_assert "") +#set(_cmake_feature_test_c_restrict "") + +set(_cmake_feature_test_c_variadic_macros "${_cmake_oldestSupported}") +set(_cmake_feature_test_c_function_prototypes "${_cmake_oldestSupported}") 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() |