MSVC: Remove /GR as a default CXX flag
According to the MSVC compiler option documentation /GR is on by default. There isn't any reason to specify the flag.
I also checked this is the case myself locally by running experiments and checking for the _CPPRTTI compiler definition.
That on it's own isn't enough reason to get rid of the flag though. However, for projects that choose to disable RTTI this causes issues.
This cmake discourse covers the issue quite well: https://discourse.cmake.org/t/how-to-fix-build-warning-d9025-overriding-gr-with-gr/878
Depending on your generator you will get build warnings because projects command lines will look like this:
/GR ... /GR-
This results in the build warning D9025 "Overriding 'option1' with 'option2'"
The only way for projects to workaround this is to write the following cmake code:
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
This isn't necessary and only complicates project code.
I haven't tested this on all MSVC versions in existence so it may have been necessary in the past (I really don't think). But I tested this on Ninja/Visual-Studio and haven't had problems.
As @brad.king mentioned we can't just change the default flags outright. It will at least need a policy.
What are everyone's thoughts? Is there a reason we can't do this?