s-barannikov wrote: I think we should use timestamp based approach rather than file comparison (see gcc's -MD/-MT/-MF/...). Not sure how difficult it would be to integrate it with cmake/bazel. https://github.com/llvm/llvm-project/pull/123353