summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorRaul Tambre <raul@tambre.ee>2021-02-07 09:27:21 (GMT)
committerRaul Tambre <raul@tambre.ee>2021-02-25 16:22:07 (GMT)
commit7596d8b951e34c61b73e54a38cca86bdcf89dad8 (patch)
treee40bb87c19db86ce2ad28345e99918de915c810a /Tests/RunCMake
parentc99db7153337865861ccb79c8f855d4d9f3539fc (diff)
downloadCMake-7596d8b951e34c61b73e54a38cca86bdcf89dad8.zip
CMake-7596d8b951e34c61b73e54a38cca86bdcf89dad8.tar.gz
CMake-7596d8b951e34c61b73e54a38cca86bdcf89dad8.tar.bz2
CMakeCCompilerId: Fix C standard detection in Clang MSVC mode
Clang doesn't define __STDC__ if in MSVC compatibility mode, but does define __STDC_VERSION__. Avoid the fallback for this combination.
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CMakeLists.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index fed0841..5f8ff42 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -417,6 +417,13 @@ function(add_RunCMake_test_try_compile)
set(CMAKE_C_STANDARD_DEFAULT "")
endif()
endif()
+ if(CMAKE_VERSION VERSION_LESS 3.20.20210225 AND "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang")
+ # Older CMake versions do not know about Clang MSVC compatibility mode
+ # standards. Approximate the logic from Clang-C.cmake.
+ if(CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.5.2)
+ set(CMAKE_C_STANDARD_DEFAULT 11)
+ endif()
+ endif()
foreach(var
CMAKE_SYSTEM_NAME
CMAKE_C_COMPILER_ID