cmake: Fix clang-tidy "no input files" errors

This change is technically not needed to add libmultiprocess as a subtree, but
it avoids a CI failure in followup PR #30975 which enables multiprocess build
option in more CI jobs. In that PR, clang-tidy job fails due to missing
generated example files as reported
https://github.com/bitcoin/bitcoin/pull/30975#issuecomment-2627116832

Different fixes were suggested
https://github.com/bitcoin/bitcoin/pull/30975#issuecomment-2627152623 and
https://github.com/bitcoin/bitcoin/pull/30975#issuecomment-2627403382

Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
This commit is contained in:
Ryan Ofsky 2025-01-31 08:51:17 -05:00
parent abdf3cb645
commit d4bc563982

View file

@ -29,4 +29,10 @@ function(add_libmultiprocess subdir)
# Add tests to "all" target so ctest can run them
set_target_properties(mptests PROPERTIES EXCLUDE_FROM_ALL OFF)
endif()
# Exclude examples from compilation database, because the examples are not
# built by default, and they contain generated c++ code. Without this
# 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)
endfunction()