From efa7e3bc6e69fba2f0b6be7c15e7097e96d498b0 Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Sat, 20 Jan 2024 19:41:57 +0400 Subject: [PATCH] Ported conda-forge patch to work with latest protobuf (#22277) --- thirdparty/dependencies.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/thirdparty/dependencies.cmake b/thirdparty/dependencies.cmake index fc6ef40c64c9bd..78860f2cd86aa3 100644 --- a/thirdparty/dependencies.cmake +++ b/thirdparty/dependencies.cmake @@ -323,7 +323,15 @@ if(ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_TF_FRONTEND # otherwise, fallback to existing default find_package(Protobuf 3.20.3 REQUIRED ${protobuf_config}) endif() - set(PROTOC_EXECUTABLE protobuf::protoc) + + # with newer protobuf versions (4.22 and newer), we use CONFIG first + # so, the Protobuf_PROTOC_EXECUTABLE variable must be checked explicitly, + # because it's not used in this case (oppositely to MODULE case) + if(Protobuf_VERSION VERSION_GREATER_EQUAL 22 AND DEFINED Protobuf_PROTOC_EXECUTABLE) + set(PROTOC_EXECUTABLE ${Protobuf_PROTOC_EXECUTABLE}) + else() + set(PROTOC_EXECUTABLE protobuf::protoc) + endif() else() add_subdirectory(thirdparty/protobuf EXCLUDE_FROM_ALL) endif()