diff options
author | Brad King <brad.king@kitware.com> | 2020-11-13 16:15:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-11-13 16:46:23 (GMT) |
commit | c00a6d3967be94a1cd8dfa369d834feea3e91725 (patch) | |
tree | 00c24f1df5da1a20f8abe03bb387609a24507304 /Modules | |
parent | 6114c8e994761ae4873218499a951136a4cdd855 (diff) | |
download | CMake-c00a6d3967be94a1cd8dfa369d834feea3e91725.zip CMake-c00a6d3967be94a1cd8dfa369d834feea3e91725.tar.gz CMake-c00a6d3967be94a1cd8dfa369d834feea3e91725.tar.bz2 |
MSVC: Do not add /GR to CMAKE_CXX_FLAGS by default
The `/GR` flag has been on by default since MSVC cl 14.0 from VS 2005.
Remove it from the default flags to make it easier for projects to pass
`/GR-` themselves to turn it off.
Projects may be using string processing to replace `/GR` with another
flag, so we cannot simply drop it. Add a policy to drop it in a
compatible way.
Fixes: #21428
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index cf3e3eb..3f65475 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -163,7 +163,13 @@ foreach(lang C CXX) endif() endforeach() -set(_GR " /GR") +cmake_policy(GET CMP0117 __WINDOWS_MSVC_CMP0117) +if(__WINDOWS_MSVC_CMP0117 STREQUAL "NEW") + set(_GR "") +else() + set(_GR " /GR") +endif() +unset(__WINDOWS_MSVC_CMP0117) if(WINCE) foreach(lang C CXX) |