Merge bitcoin/bitcoin#35418: build: exclude mptest target from compile commands

4731049ba4 build: exclude mptest target from compile commands (Sanjana2906)

Pull request description:

  Fixes #35361

  The `mptest` target includes generated `.capnp.h` files that don't exist
  at CMake configure time. When IWYU reads `compile_commands.json`, it sees
  these non-existent files and fails.

  This PR excludes the `mptest` target from the compilation database by
  setting `EXPORT_COMPILE_COMMANDS OFF`, following the same pattern already
  applied to the `mpcalculator`, `mpprinter`, and `mpexample` targets in the
  same file.

  This change belongs in `cmake/libmultiprocess.cmake` (the integration layer).

ACKs for top commit:
  ryanofsky:
    Code review ACK 4731049ba4. Seems ok to exclude mptest from tidy & iwyu checks as this PR does. It also seems ok to go further and exclude all of libmultiprocess from tidy & iwyu checks as hebasto suggested https://github.com/bitcoin/bitcoin/pull/35418#pullrequestreview-4428862711

Tree-SHA512: 6f198d7f52251e7bc877805da37d958b02b769a0fce6ee4331a0255c34f8f670e508b794fab29b8629f07700bc81b23c638e92019c687b82c4399bc656660cc8
This commit is contained in:
merge-script
2026-06-12 13:35:27 +02:00

View File

@@ -34,5 +34,5 @@ function(add_libmultiprocess subdir)
# exclusion, tools like clang-tidy and IWYU that make use of compilation
# database would complain that the generated c++ source files do not exist. An
# alternate fix could build "mpexamples" by default like "mptests" above.
set_target_properties(mpcalculator mpprinter mpexample PROPERTIES EXPORT_COMPILE_COMMANDS OFF)
set_target_properties(mpcalculator mpprinter mpexample mptest PROPERTIES EXPORT_COMPILE_COMMANDS OFF)
endfunction()