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 /Tests | |
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 'Tests')
-rw-r--r-- | Tests/CMakeCommands/target_compile_features/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/CompileFeatures/CMakeLists.txt | 17 | ||||
-rw-r--r-- | Tests/CompileFeatures/genex_test.c | 12 |
3 files changed, 28 insertions, 7 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 b560acd..200aa79 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -227,43 +227,58 @@ if (C_expected_features) if (CMAKE_C_COMPILER_ID STREQUAL "GNU") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) list(APPEND expected_defs + EXPECT_C_RESTRICT=1 EXPECT_C_STATIC_ASSERT=1 ) else() list(APPEND expected_defs + EXPECT_C_RESTRICT=1 EXPECT_C_STATIC_ASSERT=0 ) endif() elseif(CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_C_COMPILER_ID STREQUAL "AppleClang") list(APPEND expected_defs + EXPECT_C_RESTRICT=1 EXPECT_C_STATIC_ASSERT=1 ) elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel") if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 15) list(APPEND expected_defs + EXPECT_C_RESTRICT=1 EXPECT_C_STATIC_ASSERT=1 ) else() list(APPEND expected_defs + EXPECT_C_RESTRICT=1 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 + EXPECT_C_RESTRICT=1 EXPECT_C_STATIC_ASSERT=1 ) else() list(APPEND expected_defs + EXPECT_C_RESTRICT=1 EXPECT_C_STATIC_ASSERT=0 ) endif() + else() + list(APPEND expected_defs + EXPECT_C_RESTRICT=1 + ) endif() list(APPEND expected_defs EXPECT_C_FUNCTION_PROTOTYPES=1 - EXPECT_C_RESTRICT=1 ) target_compile_definitions(CompileFeaturesGenex_C PRIVATE diff --git a/Tests/CompileFeatures/genex_test.c b/Tests/CompileFeatures/genex_test.c index 1d54840..e58d793 100644 --- a/Tests/CompileFeatures/genex_test.c +++ b/Tests/CompileFeatures/genex_test.c @@ -8,7 +8,7 @@ #error EXPECT_C_RESTRICT not defined #endif -#if !EXPECT_C_STATIC_ASSERT +#if !HAVE_C_STATIC_ASSERT #if EXPECT_C_STATIC_ASSERT #error "Expect c_static_assert feature" #endif @@ -18,11 +18,17 @@ #endif #endif -#if !EXPECT_C_FUNCTION_PROTOTYPES +#if !HAVE_C_FUNCTION_PROTOTYPES +#if EXPECT_C_FUNCTION_PROTOTYPES #error Expect c_function_prototypes support #endif +#else +#if !EXPECT_C_FUNCTION_PROTOTYPES +#error Expect no c_function_prototypes support +#endif +#endif -#if !EXPECT_C_RESTRICT +#if !HAVE_C_RESTRICT #if EXPECT_C_RESTRICT #error Expect c_restrict support #endif |