diff --git a/cmake/protobuf.cmake b/cmake/protobuf.cmake index fccabd455a8..cb799b52953 100644 --- a/cmake/protobuf.cmake +++ b/cmake/protobuf.cmake @@ -53,6 +53,11 @@ if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module") endif() elseif("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "package") find_package(Protobuf REQUIRED ${gRPC_PROTOBUF_PACKAGE_TYPE}) + + # {Protobuf,PROTOBUF}_FOUND is defined based on find_package type ("MODULE" vs "CONFIG"). + # For "MODULE", the case has also changed between cmake 3.5 and 3.6. + # We use the legacy uppercase version for *_LIBRARIES AND *_INCLUDE_DIRS variables + # as newer cmake versions provide them too for backward compatibility. if(Protobuf_FOUND OR PROTOBUF_FOUND) if(TARGET protobuf::${_gRPC_PROTOBUF_LIBRARY_NAME}) set(_gRPC_PROTOBUF_LIBRARIES protobuf::${_gRPC_PROTOBUF_LIBRARY_NAME})