From c52dab40e472c198905cf6349757237f87945809 Mon Sep 17 00:00:00 2001 From: kevin Heifner Date: Fri, 22 May 2026 15:24:00 -0500 Subject: [PATCH] cmake: link magic_enum into add_native_contract targets 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 . 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. --- cmake/CDTMacros.cmake.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/CDTMacros.cmake.in b/cmake/CDTMacros.cmake.in index 11ab467ee..b2cbc7834 100644 --- a/cmake/CDTMacros.cmake.in +++ b/cmake/CDTMacros.cmake.in @@ -241,6 +241,12 @@ function(add_native_contract) "${CDT_ROOT}/include" ) + # OPP-generated protobuf headers (types.pb.hpp) depend on magic_enum. The + # imported target name is identical in the CDT and consumer vcpkg trees, so + # linking it resolves the header for the host compiler. + find_cdt_magic_enum() + target_link_libraries(${ARG_TARGET} PRIVATE magic_enum::magic_enum) + # Compile definitions for native mode target_compile_definitions(${ARG_TARGET} PRIVATE __sysio_cdt_native__