Fix magic_enum discovery for build-dir CDT_ROOT#43
Closed
Conversation
When using a CDT build directory as CDT_ROOT (instead of a proper install prefix), magic_enum headers live under vcpkg_installed/ rather than the top-level include/. This caused contract builds to fail with 'magic_enum/magic_enum.hpp' file not found. - Search both installed layout (CDT_ROOT/include) and vcpkg build-dir layout (CDT_ROOT/vcpkg_installed/x64-linux/include) - Store found path in a CACHE INTERNAL variable and add it directly to target include directories, since the WASM toolchain does not propagate INTERFACE_INCLUDE_DIRECTORIES through target_link_libraries - Add magic_enum link for non-interface protobuf targets
jglanz
requested changes
Mar 26, 2026
Collaborator
jglanz
left a comment
There was a problem hiding this comment.
This won't work. The library is required and VCPKG is not available in the CDT toolchain
| ${CDT_CONTRACT_INCLUDE_PATH}") | ||
| if(NOT DEFINED _CDT_MAGIC_ENUM_INCLUDE_DIR) | ||
| # Search candidate directories: installed layout, then vcpkg build-dir layout | ||
| set(_magic_enum_search_dirs |
Collaborator
There was a problem hiding this comment.
Use correct VCPKG variables instead of specifying installed dir and triplet
Contributor
Author
|
Going with a different approach |
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 live undervcpkg_installed/rather than the top-levelinclude/, causing contract builds to fail with'magic_enum/magic_enum.hpp' file not foundfind_cdt_magic_enumnow searches both the installed layout (CDT_ROOT/include) and vcpkg build-dir layout (CDT_ROOT/vcpkg_installed/x64-linux/include)CACHE INTERNALvariable and adds it directly to target include directories, since the WASM toolchain does not propagateINTERFACE_INCLUDE_DIRECTORIESthroughtarget_link_librariesmagic_enumlink for non-interface protobuf targets intarget_add_protobuf