mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user