CMake/Tests/RunCMake/IncludeWhatYouUse
Ashish Sadanandan fcacc319d9 IWYU: Return error code if user enables error reporting
Previously CMake ignored the return code from iwyu because old versions
of the tool would exit with an error code even when no header include
violations were detected.  The iwyu project has since changed this
behavior, so the tool no longer returns an error code unless the user
enables error reporting via command line arguments.

Behavior seen with iwyu version 0.19

Source file with missing includes:
 - Case 1: iwyu arguments:
   - return code: 0
   - output: <report of all missing includes>
 - Case 2: iwyu arguments: `-Xiwyu --error`
   - return code: 1
   - output: <report of all missing includes>

Source file with no missing includes:
 - Case 1: iwyu arguments:
   - return code: 0
   - output: `(/path/to/file.cc has correct #includes/fwd-decls)`
 - Case 2: iwyu arguments: `-Xiwyu --error`
   - return code: 0
   - output: `(/path/to/file.cc has correct #includes/fwd-decls)`

Teach CMake to return the iwyu return code if the user has invoked the
tool with any of these command line arguments included:
 - `--error[=N]`
 - `--error_always[=N]`

Fixes: #24066
2023-04-25 11:18:36 -04:00
..
C-Build-stdout.txt
C-error-Build-result.txt IWYU: Return error code if user enables error reporting 2023-04-25 11:18:36 -04:00
C-error-Build-stdout.txt IWYU: Return error code if user enables error reporting 2023-04-25 11:18:36 -04:00
C-error.cmake IWYU: Return error code if user enables error reporting 2023-04-25 11:18:36 -04:00
C-launch-Build-stdout.txt
C-launch.cmake
C.cmake
CMakeLists.txt
CXX-Build-stdout.txt
CXX-error-Build-result.txt IWYU: Return error code if user enables error reporting 2023-04-25 11:18:36 -04:00
CXX-error-Build-stdout.txt IWYU: Return error code if user enables error reporting 2023-04-25 11:18:36 -04:00
CXX-error.cmake IWYU: Return error code if user enables error reporting 2023-04-25 11:18:36 -04:00
CXX-launch-Build-stdout.txt
CXX-launch.cmake
CXX.cmake
main.c
main.cxx
RunCMakeTest.cmake IWYU: Return error code if user enables error reporting 2023-04-25 11:18:36 -04:00