{
 "number": 35454,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/35454",
 "title": "cmake: skip missing example targets in libmultiprocess.cmake",
 "author": "ryanofsky",
 "author_association": "CONTRIBUTOR",
 "created_at": "2026-06-03T23:39:51Z",
 "updated_at": "2026-06-15T02:08:08Z",
 "age_days": 105,
 "draft": true,
 "labels": [
  "Build system"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "b29f7648901e9175b1f22cf71695850b82a2b342",
 "head_ref": "pr/supportrm",
 "head_repo": "ryanofsky/bitcoin",
 "head_history": [],
 "additions": 5,
 "deletions": 1,
 "changed_files": 1,
 "commit_count": 1,
 "size_bucket": "S",
 "mergeable_state": "blocked",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "concept_ack": [
     {
      "login": "hebasto",
      "url": "https://github.com/bitcoin/bitcoin/pull/35454#pullrequestreview-4428514853"
     }
    ]
   },
   "conflicts": []
  }
 },
 "acks_parsed": {
  "hebasto": {
   "kind": "concept_ack",
   "hash": null,
   "t": "2026-06-04T14:09:10Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 0,
  "stale_ack": 0,
  "concept_ack": 1,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "hebasto"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "blocked",
  "last_author_activity": "2026-06-05T16:10:47Z",
  "last_reviewer_activity": "2026-06-05T15:17:11Z",
  "last_reviewer": "hebasto",
  "author_silent_days": 104,
  "waiting_on_author_days": 0,
  "days_since_update": 94
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [],
 "body": "bitcoin-core/libmultiprocess#287 is removing the mpcalculator, mpprinter, and mpexample targets, which causes a configuration error when Bitcoin Core is compiled against the updated upstream libmultiprocess:\n\n```\nCMake Error at cmake/libmultiprocess.cmake:37 ... Can not find target to add properties to: mpcalculator\n```\n\nFix this by iterating over the targets and only calling set_target_properties if the target exists. This is not needed for subtree builds (where upstream changes do not apply directly), but is useful for custom builds with an external libmultiprocess, and is needed to keep Bitcoin Core CI jobs working in the libmultiprocess repository.",
 "commits": [
  {
   "sha": "b29f7648901e9175b1f22cf71695850b82a2b342",
   "date": "2026-06-03T23:36:09Z",
   "message": "cmake: skip missing example targets in libmultiprocess.cmake\n\nbitcoin-core/libmultiprocess#287 is removing the mpcalculator,\nmpprinter, and mpexample targets, which causes a configuration error\nwhen Bitcoin Core is compiled against the updated upstream libmultiprocess:\n\n  CMake Error at cmake/libmultiprocess.cmake:37 ...\n  Can not find target to add properties to: mpcalculator\n\nFix this by iterating over the targets and only calling\nset_target_properties if the target exists. This is not needed for\nsubtree builds (where upstream changes do not apply directly), but is\nuseful for custom builds with an external libmultiprocess, and is needed\nto keep Bitcoin Core CI jobs working in the libmultiprocess repository.\n\nCo-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>"
  }
 ],
 "timeline": [
  {
   "t": "2026-06-04T14:09:10Z",
   "kind": "review",
   "who": "hebasto",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "b29f7648901e9175b1f22cf71695850b82a2b342",
   "text": "Concept ACK on being defensive when integrating a subproject, regardless of https://github.com/bitcoin-core/libmultiprocess/pull/287.\n\nHowever, I believe that such issues should be handled by the subprojects themselves, as they shouldn't force parent projects to process CMake code they will never use. For example, for Libmultiprocess, this could be achieved with the following patch:\n```diff\n--- a/cmake/libmultiprocess.cmake\n+++ b/cmake/libmultiprocess.cmake\n@@ -29,10 +29,4 @@ function(add_libmultiprocess subdir)\n     # Add tests to \"all\" target so ctest can run them\n     set_target_properties(mptest PROPERTIES EXCLUDE_FROM_ALL OFF)\n   endif()\n-  # Exclude examples from compilation database, because the examples are not\n-  # built by default, and they contain generated c++ code. Without this\n-  # exclusion, tools like clang-tidy and IWYU that make use of compilation\n-  # database would complain that the generated c++ source files do not exist. An\n-  # alternate fix could build \"mpexamples\" by default like \"mptests\" above.\n-  set_target_properties(mpcalculator mpprinter mpexample PROPERTIES EXPORT_COMPILE_COMMANDS OFF)\n endfunction()\n--- a/src/ipc/libmultiprocess/CMakeLists.txt\n+++ b/src/ipc/libmultiprocess/CMakeLists.txt\n@@ -260,5 +260,7 @@ add_custom_target(install-lib\n add_dependencies(install-lib multiprocess)\n\n # Example and test subdirectories\n-add_subdirectory(example EXCLUDE_FROM_ALL)\n+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)\n+  add_subdirectory(example EXCLUDE_FROM_ALL)\n+endif()\n add_subdirectory(test EXCLUDE_FROM_ALL)\n```"
  },
  {
   "t": "2026-06-05T15:04:05Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "CONTRIBUTOR",
   "text": "```diff\n # Example and test subdirectories\n-add_subdirectory(example EXCLUDE_FROM_ALL)\n+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)\n+  add_subdirectory(example EXCLUDE_FROM_ALL)\n+endif()\n add_subdirectory(test EXCLUDE_FROM_ALL)\n```\n\nThis doesn't seem like a great code change to me, especially without any comment explaining why example and test directories are treated differently. In general, it seems better to me to have fewer assumptions about parent projects in subprojects, not more. So I think https://github.com/bitcoin-core/libmultiprocess/pull/287 is a cleaner way to avoid the fragility we are seeing here."
  },
  {
   "t": "2026-06-05T15:16:59Z",
   "kind": "comment",
   "who": "hebasto",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nSure. As long as it does not [\"force parent projects to process CMake code they will never use.\"](https://github.com/bitcoin/bitcoin/pull/35454#pullrequestreview-4428514853)\n\nThe `add_subdirectory()` commands may be gated by dedicated build options."
  },
  {
   "t": "2026-06-05T15:17:11Z",
   "kind": "comment",
   "who": "hebasto",
   "assoc": "MEMBER",
   "text": "cc @purpleKarrot"
  },
  {
   "t": "2026-06-05T16:10:47Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "CONTRIBUTOR",
   "text": "[quoted text omitted]\n\nAgree a build option would be slightly better than hardcoding a \"will never use\" assumption, which would be a false assumption. There are plenty of reasons parent projects might want to include examples, especially parent projects created for CI or deployment which may want to test & package them.\n\nWould probably oppose the build option, as well, though. Especially in this case when [modularization](https://github.com/bitcoin-core/libmultiprocess/pull/287) seems like a better choice. Also,  in other cases where defining all targets and having callers explicitly reference the targets they want to build is better than adding a level of indirection where options need to exist for every target and reconfiguring is necessary to build new targets. Whatever awkwardness currently exists around the compilation database seems like it should be fixed by code using the compilation database, because hardcoding targets to be excluded from database or adding options to exclude individual targets from compilation database add complexity that seems unnecessary if users of the database are can just use the parts they need and ignore the parts they don't need."
  }
 ],
 "labels_log": [
  {
   "t": "2026-06-03T23:39:55Z",
   "action": "labeled",
   "label": "Build system",
   "who": "DrahtBot"
  },
  {
   "t": "2026-06-12T13:16:41Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-06-13T10:44:27Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 5171,
 "text_tokens_estimate": 1292,
 "changed_paths": [
  "cmake/libmultiprocess.cmake"
 ],
 "files": [
  {
   "path": "cmake/libmultiprocess.cmake",
   "add": 5,
   "del": 1
  }
 ],
 "test_lines": 0,
 "git": {
  "head": "b29f7648901e9175b1f22cf71695850b82a2b342",
  "head_matches_backup": true,
  "base": "7c2718a4b82df709ee06380209747577514acbf0",
  "commits": [
   {
    "sha": "b29f764890",
    "subject": "cmake: skip missing example targets in libmultiprocess.cmake",
    "files": 1,
    "add": 5,
    "del": 1
   }
  ],
  "patch_truncated": false
 },
 "input_hash": "69e4700f7ad20b44",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}