From f4373feda85fd63b80dd357d896e23bd001578df Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 19 Aug 2020 14:48:35 -0400 Subject: Tests: Fix RunCMake.try_compile test for C standards with MSVC 19.27 Since commit f7347f28c7 (MSVC: Record support for C11 and c_restrict, 2020-08-09) we know about MSVC C language standards. Update the `RunCMake.try_compile` test to be aware of this even when CMake is itself configured by an older CMake that does not know this. --- Tests/RunCMake/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 5d00554..470f302 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -363,6 +363,15 @@ function(add_RunCMake_test_try_compile) unset(CMAKE_CXX_STANDARD_DEFAULT) endif() endif() + if(CMAKE_VERSION VERSION_LESS 3.18.20200813 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xMSVC") + # Older CMake versions do not know about MSVC language standards. + # Approximate our logic from MSVC-C.cmake. + if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 19.27) + set(CMAKE_C_STANDARD_DEFAULT 99) + else() + set(CMAKE_C_STANDARD_DEFAULT "") + endif() + endif() foreach(var CMAKE_SYSTEM_NAME CMAKE_C_COMPILER_ID -- cgit v0.12