summaryrefslogtreecommitdiff
path: root/Modules/Compiler/MSVC-CXX.cmake
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2020-05-19 10:28:26 -0400
committerBrad King <brad.king@kitware.com>2021-06-18 09:54:17 -0400
commitf29e1874adbc31c9d4643816d8b520ad4fde3b84 (patch)
treef6f5efe80b52273df560c8adc396372a5902356f /Modules/Compiler/MSVC-CXX.cmake
parent5a5c85dffd72972987cb542a4b6c9e606920cbb5 (diff)
downloadcmake-f29e1874adbc31c9d4643816d8b520ad4fde3b84.tar.gz
Compiler/MSVC: use the `-external:I` flag for system includes
See: #17904
Diffstat (limited to 'Modules/Compiler/MSVC-CXX.cmake')
-rw-r--r--Modules/Compiler/MSVC-CXX.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake
index f1c7450fad..09fe851d63 100644
--- a/Modules/Compiler/MSVC-CXX.cmake
+++ b/Modules/Compiler/MSVC-CXX.cmake
@@ -79,3 +79,9 @@ endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.05)
set(CMAKE_CXX_COMPILE_OPTIONS_JMC "-JMC")
endif()
+
+# The `/external:I` flag was made non-experimental in 19.29.30036.3.
+if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30036.3)
+ set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-external:I ")
+ set(_CMAKE_INCLUDE_SYSTEM_FLAG_CXX_WARNING "-external:W0 ")
+endif ()