Skip to content

Fix magic_enum discovery for build-dir CDT_ROOT#44

Open
heifner wants to merge 1 commit intomasterfrom
fix/magic-enum-vcpkg-discovery
Open

Fix magic_enum discovery for build-dir CDT_ROOT#44
heifner wants to merge 1 commit intomasterfrom
fix/magic-enum-vcpkg-discovery

Conversation

@heifner
Copy link
Copy Markdown
Contributor

@heifner heifner commented Mar 26, 2026

Summary

  • When using a CDT build directory as CDT_ROOT (not an installed prefix), magic_enum headers are in vcpkg_installed/ rather than include/, causing 'magic_enum/magic_enum.hpp' file not found
  • Add vcpkg fallback path in find_cdt_magic_enum using VCPKG_INSTALLED_DIR and VCPKG_TARGET_TRIPLET variables (platform-independent, no hardcoded triplet)
  • Uncomment the CDT_CONTRACT_INCLUDE_PATH search path that was previously disabled
  • Add diagnostic message when contract include path is active

When using a CDT build directory as CDT_ROOT (instead of a proper
install prefix), magic_enum headers are not in CDT_ROOT/include but
in the vcpkg_installed directory. Add vcpkg path as a fallback in
find_cdt_magic_enum using VCPKG_INSTALLED_DIR and VCPKG_TARGET_TRIPLET.

Also uncomment the CDT_CONTRACT_INCLUDE_PATH search path and add a
diagnostic message when the contract include path is active.
heifner added a commit to Wire-Network/wire-sysio that referenced this pull request Mar 26, 2026
Set CDT_CONTRACT_INCLUDE_PATH from vcpkg include directory and forward
it to the CDT toolchain so contract builds can locate vcpkg-provided
headers (e.g. magic_enum) when using a CDT build directory as CDT_ROOT.

Also reformats CDT_CMAKE_ARGS for readability.

Companion to Wire-Network/wire-cdt#44.
@heifner heifner requested a review from jglanz March 26, 2026 16:14
Copy link
Copy Markdown
Collaborator

@jglanz jglanz left a comment

Choose a reason for hiding this comment

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

Approved, but give the inline comment a crack before merging

# set_target_properties(magic_enum::magic_enum PROPERTIES
# INTERFACE_INCLUDE_DIRECTORIES "${CDT_CONTRACT_INCLUDE_PATH}"
# )
elseif(IS_DIRECTORY "${CDT_CONTRACT_INCLUDE_PATH}/magic_enum")
Copy link
Copy Markdown
Collaborator

@jglanz jglanz Mar 26, 2026

Choose a reason for hiding this comment

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

One note CDT_CONTRACT_INCLUDE_PATH could be a semicolon delimited list; I'd create a nested macro invoked as find_in_cdt_contract_paths(_matched_include_path MATCH magic_enum [DIRECTORY|FILE] [MATCH_VAR_FULL _full_matched_path_with_suffix])

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.

2 participants