File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed
Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -67,14 +67,14 @@ if(TARGET grpc_cpp_plugin AND NOT TARGET gRPC::grpc_cpp_plugin)
6767endif ()
6868
6969if (NOT TARGET gRPC::grpc++)
70- message (FATAL_ERROR "A required gRPC target (grpc++) was not found " )
70+ message (FATAL_ERROR "A required gRPC target (gRPC:: grpc++) was not imported " )
7171endif ()
7272
7373if (CMAKE_CROSSCOMPILING )
7474 find_program (gRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
7575else ()
7676 if (NOT TARGET gRPC::grpc_cpp_plugin)
77- message (FATAL_ERROR "A required gRPC target (grpc_cpp_plugin) was not found " )
77+ message (FATAL_ERROR "A required gRPC target (gRPC:: grpc_cpp_plugin) was not imported " )
7878 endif ()
7979 set (gRPC_CPP_PLUGIN_EXECUTABLE "$<TARGET_FILE:gRPC::grpc_cpp_plugin>" )
8080endif ()
Original file line number Diff line number Diff line change @@ -22,11 +22,18 @@ if(DEFINED gRPC_PROVIDER AND NOT gRPC_PROVIDER STREQUAL "find_package" AND TARGE
2222 set (Protobuf_PROVIDER "grpc_submodule" )
2323else ()
2424
25+ # Search for an installed Protobuf package explicitly using the CONFIG search mode first followed by the MODULE search mode.
26+ # Protobuf versions < 3.22.0 may be found using the module mode and some protobuf apt packages do not support the CONFIG search.
27+
2528 find_package (Protobuf CONFIG QUIET )
2629 set (Protobuf_PROVIDER "find_package" )
2730
2831 if (NOT Protobuf_FOUND)
29- FectchContent_Declare(
32+ find_package (Protobuf MODULE QUIET )
33+ endif ()
34+
35+ if (NOT Protobuf_FOUND)
36+ FetchContent_Declare(
3037 "protobuf"
3138 GIT_REPOSITORY "https://github.com/protocolbuffers/protobuf.git"
3239 GIT_TAG "${protobuf_GIT_TAG} "
@@ -50,14 +57,14 @@ if(TARGET libprotobuf)
5057endif ()
5158
5259if (NOT TARGET protobuf::libprotobuf)
53- message (FATAL_ERROR "A required protobuf target (protobuf::libprotobuf) was not found " )
60+ message (FATAL_ERROR "A required protobuf target (protobuf::libprotobuf) was not imported " )
5461endif ()
5562
5663if (CMAKE_CROSSCOMPILING )
5764 find_program (PROTOBUF_PROTOC_EXECUTABLE protoc)
5865else ()
5966 if (NOT TARGET protobuf::protoc)
60- message (FATAL_ERROR "A required protobuf target (protobuf::protoc) was not found " )
67+ message (FATAL_ERROR "A required protobuf target (protobuf::protoc) was not imported " )
6168 endif ()
6269 set (PROTOBUF_PROTOC_EXECUTABLE "$<TARGET_FILE:protobuf::protoc>" )
6370endif ()
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ target_link_libraries(opentelemetry_otlp_recordable
3232 PUBLIC opentelemetry_metrics)
3333
3434if (WITH_OTLP_GRPC)
35- find_package (gRPC REQUIRED)
3635 if (NOT DEFINED grpc_lib_type)
3736 message (
3837 FATAL_ERROR "cmake/opentelemetry-proto.cmake should be included first" )
You can’t perform that action at this time.
0 commit comments