Warnings as errors?

I scoured the documentation but can’t find an easy way to make warnings get flagged as errors instead by the C++ compiler.

I got it to work by adding this to UE4Editor.target.cs and my own Editor target, but this seems fragile and a lot of work for such an obvious thing.

AdditionalCompilerArguments = "/WX";

Check out DefaultWarningLevel in your *.target.cs

No use to change DefaultWarningLevel in the *.target.cs. I want to disable a warning as error, this can take effect:
AdditionalCompilerArguments = "-Wno-unused-but-set-variable";