From 4ed22ee7773f5397846f482d8fef3338c125451b Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Thu, 20 Mar 2025 22:10:27 -0600 Subject: [PATCH 1/2] remove otlp_grpc_exporter_test link to gRPC::grpc++ --- exporters/otlp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exporters/otlp/CMakeLists.txt b/exporters/otlp/CMakeLists.txt index bccc15a8f8..78fabbb8e4 100644 --- a/exporters/otlp/CMakeLists.txt +++ b/exporters/otlp/CMakeLists.txt @@ -321,7 +321,7 @@ if(BUILD_TESTING) add_executable(otlp_grpc_exporter_test test/otlp_grpc_exporter_test.cc) target_link_libraries( otlp_grpc_exporter_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - ${GMOCK_LIB} opentelemetry_exporter_otlp_grpc gRPC::grpc++) + ${GMOCK_LIB} opentelemetry_exporter_otlp_grpc) gtest_add_tests( TARGET otlp_grpc_exporter_test TEST_PREFIX exporter.otlp. From 1c3616898034194add63829b68532b681ef2a9d3 Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Sun, 23 Mar 2025 23:39:37 -0600 Subject: [PATCH 2/2] make grpc's link public to the grpc client. make ext's link private to grpc client. remove extra protobuf links to tests. add missing curl link to zipkin test --- exporters/otlp/CMakeLists.txt | 45 ++++++++++----------------------- exporters/zipkin/CMakeLists.txt | 9 +++++-- 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/exporters/otlp/CMakeLists.txt b/exporters/otlp/CMakeLists.txt index 78fabbb8e4..4891d4381b 100644 --- a/exporters/otlp/CMakeLists.txt +++ b/exporters/otlp/CMakeLists.txt @@ -38,18 +38,11 @@ if(WITH_OTLP_GRPC) # targets that depend on opentelemetry_proto_grpc. target_link_libraries( opentelemetry_exporter_otlp_grpc_client - PUBLIC opentelemetry_sdk opentelemetry_common opentelemetry_ext + PUBLIC opentelemetry_sdk opentelemetry_common # gRPC::grpc++ must be linked before opentelemetry_proto_grpc. - opentelemetry_proto_grpc - PRIVATE gRPC::grpc++) - - get_target_property(GRPC_INCLUDE_DIRECTORY gRPC::grpc++ - INTERFACE_INCLUDE_DIRECTORIES) - if(GRPC_INCLUDE_DIRECTORY) - target_include_directories( - opentelemetry_exporter_otlp_grpc_client BEFORE - PUBLIC "$") - endif() + opentelemetry_proto_grpc gRPC::grpc++ + PRIVATE opentelemetry_ext) + target_include_directories( opentelemetry_exporter_otlp_grpc_client PUBLIC "$" @@ -290,9 +283,8 @@ endif() if(BUILD_TESTING) add_executable(otlp_recordable_test test/otlp_recordable_test.cc) - target_link_libraries( - otlp_recordable_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - opentelemetry_otlp_recordable protobuf::libprotobuf) + target_link_libraries(otlp_recordable_test ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} opentelemetry_otlp_recordable) gtest_add_tests( TARGET otlp_recordable_test TEST_PREFIX exporter.otlp. @@ -308,10 +300,8 @@ if(BUILD_TESTING) add_executable(otlp_metrics_serialization_test test/otlp_metrics_serialization_test.cc) - target_link_libraries( - otlp_metrics_serialization_test ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} opentelemetry_otlp_recordable - protobuf::libprotobuf) + target_link_libraries(otlp_metrics_serialization_test ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} opentelemetry_otlp_recordable) gtest_add_tests( TARGET otlp_metrics_serialization_test TEST_PREFIX exporter.otlp. @@ -396,8 +386,7 @@ if(BUILD_TESTING) ${GMOCK_LIB} opentelemetry_exporter_otlp_http opentelemetry_http_client_nosend - nlohmann_json::nlohmann_json - protobuf::libprotobuf) + nlohmann_json::nlohmann_json) gtest_add_tests( TARGET otlp_http_exporter_test TEST_PREFIX exporter.otlp. @@ -450,8 +439,7 @@ if(BUILD_TESTING) opentelemetry_exporter_otlp_http_metric opentelemetry_metrics opentelemetry_http_client_nosend - nlohmann_json::nlohmann_json - protobuf::libprotobuf) + nlohmann_json::nlohmann_json) gtest_add_tests( TARGET otlp_http_metric_exporter_test TEST_PREFIX exporter.otlp. @@ -486,13 +474,9 @@ if(BUILD_TESTING) add_executable(otlp_file_exporter_test test/otlp_file_exporter_test.cc) target_link_libraries( - otlp_file_exporter_test - ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${GMOCK_LIB} - opentelemetry_exporter_otlp_file - nlohmann_json::nlohmann_json - protobuf::libprotobuf) + otlp_file_exporter_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + ${GMOCK_LIB} opentelemetry_exporter_otlp_file + nlohmann_json::nlohmann_json) gtest_add_tests( TARGET otlp_file_exporter_test TEST_PREFIX exporter.otlp. @@ -543,8 +527,7 @@ if(BUILD_TESTING) ${GMOCK_LIB} opentelemetry_exporter_otlp_file_metric opentelemetry_metrics - nlohmann_json::nlohmann_json - protobuf::libprotobuf) + nlohmann_json::nlohmann_json) gtest_add_tests( TARGET otlp_file_metric_exporter_test TEST_PREFIX exporter.otlp. diff --git a/exporters/zipkin/CMakeLists.txt b/exporters/zipkin/CMakeLists.txt index 5944258ca3..80d0264687 100644 --- a/exporters/zipkin/CMakeLists.txt +++ b/exporters/zipkin/CMakeLists.txt @@ -52,8 +52,13 @@ if(BUILD_TESTING) add_executable(zipkin_exporter_test test/zipkin_exporter_test.cc) target_link_libraries( - zipkin_exporter_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} - ${GMOCK_LIB} opentelemetry_exporter_zipkin_trace opentelemetry_resources) + zipkin_exporter_test + ${GTEST_BOTH_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${GMOCK_LIB} + opentelemetry_exporter_zipkin_trace + opentelemetry_resources + ${CURL_LIBRARIES}) gtest_add_tests( TARGET zipkin_exporter_test