Capture IWYU return code
I just discovered that the CMake IWYU code masks any return code that IWYU returns, claiming that it always returns non-zero. From my experience, IWYU returns 0 unless you pass it -Xiwyu --error
.
Unfortunately, this makes it very difficult to fail on IWYU warnings without doing a CTest script. Even when IWYU returns an error code, compilation continues as normal. The only way to fail on IWYU warnings is to capture stderr and fail if there's anything on it.
I believe that the "IWYU always returns non-zero" assumption is outdated and should be revisited. The trouble is, how do we do this while still supporting older versions of IWYU?
Edited by Kyle Edwards