Browse Source

Merge topic 'msvc_static_assert'

95bc11dbb4 MSVC: Record support for c_static_assert

Acked-by: Kitware Robot <[email protected]>
Merge-request: !5148
Brad King 5 years ago
parent
commit
4294526504
3 changed files with 15 additions and 6 deletions
  1. 10 3
      Help/release/3.18.rst
  2. 1 3
      Modules/Compiler/MSVC-C-FeatureTests.cmake
  3. 4 0
      Modules/Compiler/MSVC-C.cmake

+ 10 - 3
Help/release/3.18.rst

@@ -265,8 +265,9 @@ Other
   environment variable to customize colors.
 
 * The :manual:`Compile Features <cmake-compile-features(7)>` functionality
-  is now aware of the availability of C11 features in MSVC 19.27 and above,
-  including support for the ``c_restrict`` feature and the ``-std:c11`` flag.
+  is now aware of the availability of C11 features in MSVC 19.27 and 19.28,
+  including support for the ``c_restrict``, ``c_static_assert`` features and
+  the ``-std:c11`` flag.
 
 Deprecated and Removed Features
 ===============================
@@ -353,4 +354,10 @@ Changes made since CMake 3.18.0 include the following.
   This restores compatibility with behavior of CMake 3.15 and below.
 
 * The :manual:`Compile Features <cmake-compile-features(7)>` functionality
-  was updated for MSVC 19.27 as mentioned above.
+  was updated for MSVC 19.27 as mentioned above (``c_restrict``).
+
+3.18.3
+------
+
+* The :manual:`Compile Features <cmake-compile-features(7)>` functionality
+  was updated for MSVC 19.28 as mentioned above (``c_static_assert``).

+ 1 - 3
Modules/Compiler/MSVC-C-FeatureTests.cmake

@@ -1,9 +1,7 @@
 set(_cmake_oldestSupported "_MSC_VER >= 1600")
 
-# Not yet supported:
-#set(_cmake_feature_test_c_static_assert "")
-
 set(_cmake_feature_test_c_restrict "_MSC_VER >= 1927")
+set(_cmake_feature_test_c_static_assert "_MSC_VER >= 1928")
 
 set(_cmake_feature_test_c_variadic_macros "${_cmake_oldestSupported}")
 set(_cmake_feature_test_c_function_prototypes "${_cmake_oldestSupported}")

+ 4 - 0
Modules/Compiler/MSVC-C.cmake

@@ -51,6 +51,10 @@ macro(cmake_record_c_compile_features)
     list(APPEND CMAKE_C_COMPILE_FEATURES c_restrict)
     list(APPEND CMAKE_C99_COMPILE_FEATURES c_restrict)
   endif()
+  if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28)
+    list(APPEND CMAKE_C_COMPILE_FEATURES c_static_assert)
+    list(APPEND CMAKE_C11_COMPILE_FEATURES c_static_assert)
+  endif()
   set(_result 0) # expected by cmake_determine_compile_features
 endmacro()