Fix magic_enum discovery for build-dir CDT_ROOT#44
Open
Conversation
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.
jglanz
approved these changes
Mar 26, 2026
Collaborator
jglanz
left a comment
There was a problem hiding this comment.
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") |
Collaborator
There was a problem hiding this comment.
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])
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CDT_ROOT(not an installed prefix),magic_enumheaders are invcpkg_installed/rather thaninclude/, causing'magic_enum/magic_enum.hpp' file not foundfind_cdt_magic_enumusingVCPKG_INSTALLED_DIRandVCPKG_TARGET_TRIPLETvariables (platform-independent, no hardcoded triplet)CDT_CONTRACT_INCLUDE_PATHsearch path that was previously disabled