diff --git a/CMakeLists.txt b/CMakeLists.txt index 10c1a0ab6f..f57ce47779 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -430,6 +430,11 @@ if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP) if(TARGET protobuf::protoc) project_build_tools_get_imported_location(PROTOBUF_PROTOC_EXECUTABLE protobuf::protoc) + # If protobuf::protoc is not a imported target, then we use the target + # directly for fallback + if(NOT PROTOBUF_PROTOC_EXECUTABLE) + set(PROTOBUF_PROTOC_EXECUTABLE protobuf::protoc) + endif() elseif(Protobuf_PROTOC_EXECUTABLE) # Some versions of FindProtobuf.cmake uses mixed case instead of uppercase set(PROTOBUF_PROTOC_EXECUTABLE ${Protobuf_PROTOC_EXECUTABLE})