Skip to content

cmake: Add mp_headers custom target#291

Open
hebasto wants to merge 1 commit into
bitcoin-core:masterfrom
hebasto:260605-codegen
Open

cmake: Add mp_headers custom target#291
hebasto wants to merge 1 commit into
bitcoin-core:masterfrom
hebasto:260605-codegen

Conversation

@hebasto
Copy link
Copy Markdown
Member

@hebasto hebasto commented Jun 5, 2026

This convenience target allows generating Cap'n Proto C++ source files, which is useful as the capnp_generate_cpp function is not CODEGEN-aware.

Required for bitcoin/bitcoin#35468.

@DrahtBot
Copy link
Copy Markdown

DrahtBot commented Jun 5, 2026

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
Stale ACK ryanofsky

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Copy link
Copy Markdown
Collaborator

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK 941f692. It seems like a good idea to expose a target that will generate the library headers so outside targets can depend on them, and since they are probably needed for most static analysis.

But I'm not sure why PR description says this is required for bitcoin/bitcoin#35468 when it doesn't seem to be referenced there. I wonder if this target is required for anything in particular.

Could also consider making this definition more consistent with target_capnp_sources:

add_custom_target("${target}_headers" DEPENDS ${generated_headers})

with:

add_custom_target(mp_headers DEPENDS ${MP_PROXY_HDRS})

But current definition seems ok.

@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Jun 5, 2026

But I'm not sure why PR description says this is required for bitcoin/bitcoin#35468 when it doesn't seem to be referenced there. I wonder if this target is required for anything in particular.

I've updated bitcoin/bitcoin#35468. Please see bitcoin/bitcoin#35468 (comment).

@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Jun 5, 2026

Could also consider making this definition more consistent with target_capnp_sources:

add_custom_target("${target}_headers" DEPENDS ${generated_headers})

with:

add_custom_target(mp_headers DEPENDS ${MP_PROXY_HDRS})

I've been thinking about changes in the opposite direction. The _codegen suffix for such build targets seems consistent with CMake's codegen default target.

This convenience target allows generating Cap'n Proto C++ source files,
which is useful as the `capnp_generate_cpp` function is not
CODEGEN-aware.
@hebasto hebasto changed the title cmake: Add mp_proxy_codegen custom target cmake: Add mp_headers custom target Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants