summaryrefslogtreecommitdiffstats
path: root/Tests
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 /Tests
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 'Tests')
-rw-r--r--Tests/CMakeCommands/target_compile_features/CMakeLists.txt6
-rw-r--r--Tests/CompileFeatures/CMakeLists.txt5
2 files changed, 8 insertions, 3 deletions
diff --git a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
index 5096a58..9664025 100644
--- a/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
+++ b/Tests/CMakeCommands/target_compile_features/CMakeLists.txt
@@ -1,5 +1,4 @@
-cmake_minimum_required(VERSION 3.0)
-cmake_policy(SET CMP0057 NEW)
+cmake_minimum_required(VERSION 3.3)
project(target_compile_features)
set(CMAKE_VERBOSE_MAKEFILE ON)
@@ -19,7 +18,8 @@ if (c_restrict IN_LIST CMAKE_C_COMPILE_FEATURES)
target_link_libraries(c_restrict_user_specific c_lib_restrict_specific)
endif()
-if (c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES)
+if (c_std_99 IN_LIST CMAKE_C_COMPILE_FEATURES AND
+ NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
add_executable(c_target_compile_features_meta main.c)
target_compile_features(c_target_compile_features_meta
PRIVATE c_std_99
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index 0271cd6..200aa79 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -254,6 +254,11 @@ if (C_expected_features)
EXPECT_C_STATIC_ASSERT=0
)
endif()
+ elseif(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+ list(APPEND expected_defs
+ EXPECT_C_RESTRICT=0
+ EXPECT_C_STATIC_ASSERT=0
+ )
elseif (CMAKE_C_COMPILER_ID STREQUAL "SunPro")
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.13)
list(APPEND expected_defs