diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2020-05-19 14:28:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-06-18 13:54:17 (GMT) |
commit | f29e1874adbc31c9d4643816d8b520ad4fde3b84 (patch) | |
tree | f6f5efe80b52273df560c8adc396372a5902356f /Modules/Compiler | |
parent | 5a5c85dffd72972987cb542a4b6c9e606920cbb5 (diff) | |
download | CMake-f29e1874adbc31c9d4643816d8b520ad4fde3b84.zip CMake-f29e1874adbc31c9d4643816d8b520ad4fde3b84.tar.gz CMake-f29e1874adbc31c9d4643816d8b520ad4fde3b84.tar.bz2 |
Compiler/MSVC: use the `-external:I` flag for system includes
See: #17904
Diffstat (limited to 'Modules/Compiler')
-rw-r--r-- | Modules/Compiler/MSVC-C.cmake | 6 | ||||
-rw-r--r-- | Modules/Compiler/MSVC-CXX.cmake | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Modules/Compiler/MSVC-C.cmake b/Modules/Compiler/MSVC-C.cmake index 9a5104b..73cca36 100644 --- a/Modules/Compiler/MSVC-C.cmake +++ b/Modules/Compiler/MSVC-C.cmake @@ -63,3 +63,9 @@ endmacro() if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.05) set(CMAKE_C_COMPILE_OPTIONS_JMC "-JMC") endif() + +# The `/external:I` flag was made non-experimental in 19.29.30036.3. +if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 19.29.30036.3) + set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-external:I ") + set(_CMAKE_INCLUDE_SYSTEM_FLAG_C_WARNING "-external:W0 ") +endif () diff --git a/Modules/Compiler/MSVC-CXX.cmake b/Modules/Compiler/MSVC-CXX.cmake index f1c7450..09fe851 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 () |