summaryrefslogtreecommitdiffstats
path: root/compiler-rt/cmake/config-ix.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/cmake/config-ix.cmake')
-rw-r--r--compiler-rt/cmake/config-ix.cmake9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake
index e7f315cf8f0..28eb54be3ab 100644
--- a/compiler-rt/cmake/config-ix.cmake
+++ b/compiler-rt/cmake/config-ix.cmake
@@ -154,10 +154,15 @@ elseif(NOT APPLE) # Supported archs for Apple platforms are generated later
test_target_arch(i686 __i686__ "-m32")
test_target_arch(i386 __i386__ "-m32")
else()
+ # Extract the major version from CMake's MSVC_VERSION variable and pass
+ # it to -fms-compatibility-version. The major version controls the most
+ # important parts of clang's compatibility.
+ string(SUBSTRING "${MSVC_VERSION}" 0 2 MSVC_MAJOR_VERSION)
+ set(flags "-fms-compatibility-version=${MSVC_MAJOR_VERSION}")
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
- test_target_arch(i386 "" "")
+ test_target_arch(i386 "" "${flags}")
else()
- test_target_arch(x86_64 "" "")
+ test_target_arch(x86_64 "" "${flags}")
endif()
endif()
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
OpenPOWER on IntegriCloud