Skip to content

Commit af168c1

Browse files
committed
Address feedback from code review assistant
1 parent b3ea598 commit af168c1

1 file changed

Lines changed: 23 additions & 15 deletions

File tree

google/cloud/storage/google_cloud_cpp_storage_grpc.cmake

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,29 @@ if (GOOGLE_CLOUD_CPP_ENABLE_CTYPE_CORD_WORKAROUND)
253253
google_cloud_cpp_storage_grpc
254254
PRIVATE GOOGLE_CLOUD_CPP_ENABLE_CTYPE_CORD_WORKAROUND)
255255
endif ()
256-
if ((TARGET google-cloud-cpp::opentelemetry) AND (TARGET
257-
opentelemetry-cpp::metrics))
258-
target_compile_definitions(
259-
google_cloud_cpp_storage_grpc
260-
PUBLIC GOOGLE_CLOUD_CPP_STORAGE_WITH_OTEL_METRICS
261-
GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY)
262-
target_link_libraries(
263-
google_cloud_cpp_storage_grpc PUBLIC google-cloud-cpp::opentelemetry
264-
opentelemetry-cpp::metrics)
265-
endif ()
266-
if (TARGET gRPC::grpcpp_otel_plugin)
256+
set(EXTRA_MODULES)
257+
258+
if (TARGET google-cloud-cpp::opentelemetry)
259+
target_compile_definitions(google_cloud_cpp_storage_grpc
260+
PUBLIC GOOGLE_CLOUD_CPP_HAVE_OPENTELEMETRY)
267261
target_link_libraries(google_cloud_cpp_storage_grpc
268-
PUBLIC gRPC::grpcpp_otel_plugin)
269-
set(EXTRA_MODULES "grpcpp_otel_plugin")
262+
PUBLIC google-cloud-cpp::opentelemetry)
263+
list(APPEND EXTRA_MODULES "google_cloud_cpp_opentelemetry")
264+
265+
if (TARGET opentelemetry-cpp::metrics)
266+
target_compile_definitions(
267+
google_cloud_cpp_storage_grpc
268+
PUBLIC GOOGLE_CLOUD_CPP_STORAGE_WITH_OTEL_METRICS)
269+
target_link_libraries(google_cloud_cpp_storage_grpc
270+
PUBLIC opentelemetry-cpp::metrics)
271+
list(APPEND EXTRA_MODULES "opentelemetry_metrics")
272+
273+
if (TARGET gRPC::grpcpp_otel_plugin)
274+
target_link_libraries(google_cloud_cpp_storage_grpc
275+
PUBLIC gRPC::grpcpp_otel_plugin)
276+
list(APPEND EXTRA_MODULES "grpcpp_otel_plugin")
277+
endif ()
278+
endif ()
270279
endif ()
271280
set_target_properties(
272281
google_cloud_cpp_storage_grpc
@@ -501,8 +510,7 @@ foreach (fname ${storage_client_grpc_unit_tests})
501510
CURL::libcurl
502511
nlohmann_json::nlohmann_json)
503512
google_cloud_cpp_add_common_options(${target})
504-
if ((TARGET gRPC::grpcpp_otel_plugin)
505-
AND (TARGET google-cloud-cpp::opentelemetry)
513+
if ((TARGET google-cloud-cpp::opentelemetry)
506514
AND (TARGET opentelemetry-cpp::metrics))
507515
target_compile_definitions(
508516
${target} PRIVATE GOOGLE_CLOUD_CPP_STORAGE_WITH_OTEL_METRICS)

0 commit comments

Comments
 (0)