From 7da7037dec49a4ef7efc9465dc9f98e212001d4c Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Tue, 23 May 2023 13:39:07 -0400 Subject: [PATCH] Unneeded dependencies that leak through to application build --- cmake/opentelemetry-proto.cmake | 2 +- exporters/otlp/CMakeLists.txt | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake index 34b33d3cff..27bfd72ee2 100644 --- a/cmake/opentelemetry-proto.cmake +++ b/cmake/opentelemetry-proto.cmake @@ -294,7 +294,7 @@ if(OPENTELEMETRY_INSTALL) endif() if(TARGET protobuf::libprotobuf) - target_link_libraries(opentelemetry_proto PUBLIC protobuf::libprotobuf) + target_link_libraries(opentelemetry_proto PRIVATE protobuf::libprotobuf) else() # cmake 3.8 or lower target_include_directories(opentelemetry_proto PUBLIC ${Protobuf_INCLUDE_DIRS}) diff --git a/exporters/otlp/CMakeLists.txt b/exporters/otlp/CMakeLists.txt index 386bfcd918..b453b790d4 100644 --- a/exporters/otlp/CMakeLists.txt +++ b/exporters/otlp/CMakeLists.txt @@ -113,7 +113,7 @@ if(WITH_OTLP_HTTP) target_link_libraries( opentelemetry_exporter_otlp_http_client - PUBLIC opentelemetry_sdk opentelemetry_proto opentelemetry_http_client_curl + PRIVATE opentelemetry_sdk opentelemetry_proto opentelemetry_http_client_curl nlohmann_json::nlohmann_json) if(nlohmann_json_clone) add_dependencies(opentelemetry_exporter_otlp_http_client @@ -198,7 +198,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) + ${CMAKE_THREAD_LIBS_INIT} opentelemetry_otlp_recordable + protobuf::libprotobuf) gtest_add_tests( TARGET otlp_recordable_test TEST_PREFIX exporter.otlp. @@ -218,7 +219,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) + ${CMAKE_THREAD_LIBS_INIT} opentelemetry_otlp_recordable + protobuf::libprotobuf) gtest_add_tests( TARGET otlp_metrics_serialization_test TEST_PREFIX exporter.otlp. @@ -309,7 +311,9 @@ if(BUILD_TESTING) target_link_libraries( otlp_http_exporter_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${GMOCK_LIB} opentelemetry_exporter_otlp_http - opentelemetry_http_client_nosend) + opentelemetry_http_client_nosend + nlohmann_json::nlohmann_json + protobuf::libprotobuf) gtest_add_tests( TARGET otlp_http_exporter_test TEST_PREFIX exporter.otlp. @@ -362,7 +366,9 @@ if(BUILD_TESTING) ${GMOCK_LIB} opentelemetry_exporter_otlp_http_metric opentelemetry_metrics - opentelemetry_http_client_nosend) + opentelemetry_http_client_nosend + nlohmann_json::nlohmann_json + protobuf::libprotobuf) gtest_add_tests( TARGET otlp_http_metric_exporter_test TEST_PREFIX exporter.otlp.