From d4bc5639829f0c98bd2faeddba9be4e8c6667875 Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Fri, 31 Jan 2025 08:51:17 -0500 Subject: [PATCH] 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> --- cmake/libmultiprocess.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/libmultiprocess.cmake b/cmake/libmultiprocess.cmake index 4210c53d69f..5db8f4e9e54 100644 --- a/cmake/libmultiprocess.cmake +++ b/cmake/libmultiprocess.cmake @@ -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()