Skip to content

Commit e456a20

Browse files
committed
cleanup and ci fixes
1 parent 7fc964f commit e456a20

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

cmake/grpc.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ if(TARGET grpc_cpp_plugin AND NOT TARGET gRPC::grpc_cpp_plugin)
6767
endif()
6868

6969
if(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")
7171
endif()
7272

7373
if(CMAKE_CROSSCOMPILING)
7474
find_program(gRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
7575
else()
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>")
8080
endif()

cmake/protobuf.cmake

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff 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")
2323
else()
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)
5057
endif()
5158

5259
if(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")
5461
endif()
5562

5663
if(CMAKE_CROSSCOMPILING)
5764
find_program(PROTOBUF_PROTOC_EXECUTABLE protoc)
5865
else()
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>")
6370
endif()

exporters/otlp/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ target_link_libraries(opentelemetry_otlp_recordable
3232
PUBLIC opentelemetry_metrics)
3333

3434
if(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")

0 commit comments

Comments
 (0)