# Workaround for https://github.com/protocolbuffers/protobuf/issues/18307 # Newer protobuf builds are forcibly bound to libupd which causes conflicts diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake index ebf20ab21b..a984f38701 100644 --- a/cmake/external/onnxruntime_external_deps.cmake +++ b/cmake/external/onnxruntime_external_deps.cmake @@ -230,6 +230,20 @@ endif() include(protobuf_function) #protobuf end +find_library(UPB_LIBRARIES NAMES upb) +if(NOT TARGET protobuf::libupb) + add_library(protobuf::libupb SHARED IMPORTED) +endif() +if(NOT TARGET protobuf::protoc-gen-upb) + add_executable(protobuf::protoc-gen-upb IMPORTED) +endif() +if(NOT TARGET protobuf::protoc-gen-upbdefs) + add_executable(protobuf::protoc-gen-upbdefs IMPORTED) +endif() +if(NOT TARGET protobuf::protoc-gen-upb_minitable) + add_executable(protobuf::protoc-gen-upb_minitable IMPORTED) +endif() + onnxruntime_fetchcontent_makeavailable(Protobuf) if(Protobuf_FOUND) message(STATUS "Using protobuf from find_package(or vcpkg). Protobuf version: ${Protobuf_VERSION}")