Without this change, building with -DMP_ENABLE_IWYU=ON and newer versions of
nixpkgs (after 2025-11-12) fails with mysterious errors that look like:
make[2]: *** [CMakeFiles/mputil.dir/build.make:79: CMakeFiles/mputil.dir/src/mp/util.cpp.o] Error 1
with no other error messages. The are no messages because cmake -E
__run_co_compile hides the output from IWYU and does not display anything itself.
The actual problem is missing include directories on the compiler command line,
and the fix here is to extend a workaround previously added for clang-tidy to
be used for IWYU as well.
Breakage seems to have been caused by
https://github.com/NixOS/nixpkgs/pull/445095/changes/76a8ffa6d8d2f93b81d4e9be327a01cab1c893c0
from https://github.com/NixOS/nixpkgs/pull/445095, which I found by bisecting
with --first-parent to a change between the following merge commit:
https://github.com/NixOS/nixpkgs/commits/de21549a840be528ef4763dd7dca2006caf9c11f (bad)
https://github.com/NixOS/nixpkgs/commits/c4d1151093af5d483d1900d9214a65e68bc21560 (good)
If you check out the bad commit above (or any later commit) and revert
https://github.com/NixOS/nixpkgs/commit/76a8ffa6d8d2f93b81d4e9be327a01cab1c893c0
the problem disappears.
I suspect the problem happens because cmake is not handling -cxx-isystem
properly, but did not debug further. The later change
https://github.com/NixOS/nixpkgs/pull/462747 which followed up on
https://github.com/NixOS/nixpkgs/pull/445095 did not seem to have any effect on
this issue in my testing.