Skip to content

cmake: link magic_enum into add_native_contract targets#65

Open
heifner wants to merge 1 commit into
masterfrom
fix/native-contract-magic-enum
Open

cmake: link magic_enum into add_native_contract targets#65
heifner wants to merge 1 commit into
masterfrom
fix/native-contract-magic-enum

Conversation

@heifner
Copy link
Copy Markdown
Contributor

@heifner heifner commented May 22, 2026

Summary

add_native_contract() compiles contract sources with the host compiler into a dlopen-able .so for the native-module runtime. It sets up the CDT include paths but never provided magic_enum.

Wire's OPP system contracts include generated protobuf headers (types.pb.hpp) that depend on magic_enum, so native builds of those contracts fail to find <magic_enum/magic_enum.hpp>.

This calls find_cdt_magic_enum() and links magic_enum::magic_enum into native contract targets. The imported target name is identical in the CDT and consumer (wire-sysio) vcpkg trees, so the host compiler resolves the header either way.

Context

This is the CDT-side half of the fix for the Wire-Network/wire-sysio#281 review feedback. The wire-sysio side reverts a per-contract -I workaround that had been masking this gap; the proper fix belongs here in the native-contract template.

Native contract builds compile OPP system contracts whose generated
protobuf headers (types.pb.hpp) include magic_enum. add_native_contract
set up the CDT include paths but never provided magic_enum, so the
host compiler could not find <magic_enum/magic_enum.hpp>.

Call find_cdt_magic_enum() and link magic_enum::magic_enum -- the same
imported target name in the CDT and consumer vcpkg trees -- so native
contract targets resolve the header.
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.

1 participant