Skip to content

Commit

Permalink
Link gRPC::grpc++ into dependent libs privately
Browse files Browse the repository at this point in the history
  • Loading branch information
ays7 committed Feb 4, 2023
1 parent 21d4976 commit 38d0fb3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
5 changes: 2 additions & 3 deletions exporters/ostream/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ install(
PATTERN "metric_exporter.h")
if(BUILD_TESTING)
add_executable(ostream_metric_test test/ostream_metric_test.cc)
target_link_libraries(
ostream_metric_test ${GTEST_BOTH_LIBRARIES}
opentelemetry_exporter_ostream_metrics)
target_link_libraries(ostream_metric_test ${GTEST_BOTH_LIBRARIES}
opentelemetry_exporter_ostream_metrics)
gtest_add_tests(
TARGET ostream_metric_test
TEST_PREFIX exporter.
Expand Down
24 changes: 13 additions & 11 deletions exporters/otlp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ target_include_directories(
set(OPENTELEMETRY_OTLP_TARGETS opentelemetry_otlp_recordable)
target_link_libraries(
opentelemetry_otlp_recordable
PUBLIC opentelemetry_common opentelemetry_trace opentelemetry_resources opentelemetry_proto)
PUBLIC opentelemetry_common opentelemetry_trace opentelemetry_resources
opentelemetry_proto)

if(WITH_LOGS_PREVIEW)
target_link_libraries(opentelemetry_otlp_recordable PUBLIC opentelemetry_logs)
Expand All @@ -30,10 +31,11 @@ if(WITH_OTLP_GRPC)
PROPERTIES EXPORT_NAME otlp_grpc_client)
target_link_libraries(
opentelemetry_exporter_otlp_grpc_client
PUBLIC opentelemetry_common opentelemetry_sdk opentelemetry_ext opentelemetry_proto)
PUBLIC opentelemetry_common opentelemetry_sdk opentelemetry_ext
opentelemetry_proto)

target_link_libraries(opentelemetry_exporter_otlp_grpc_client
PUBLIC gRPC::grpc++)
PRIVATE gRPC::grpc++)
get_target_property(GRPC_INCLUDE_DIRECTORY gRPC::grpc++
INTERFACE_INCLUDE_DIRECTORIES)
if(GRPC_INCLUDE_DIRECTORY)
Expand All @@ -57,8 +59,8 @@ if(WITH_OTLP_GRPC)

target_link_libraries(
opentelemetry_exporter_otlp_grpc
PUBLIC opentelemetry_otlp_recordable
opentelemetry_exporter_otlp_grpc_client)
PUBLIC opentelemetry_otlp_recordable opentelemetry_exporter_otlp_grpc_client
PRIVATE gRPC::grpc++)

list(APPEND OPENTELEMETRY_OTLP_TARGETS opentelemetry_exporter_otlp_grpc)

Expand All @@ -72,8 +74,8 @@ if(WITH_OTLP_GRPC)

target_link_libraries(
opentelemetry_exporter_otlp_grpc_log
PUBLIC opentelemetry_otlp_recordable
opentelemetry_exporter_otlp_grpc_client)
PUBLIC opentelemetry_otlp_recordable opentelemetry_exporter_otlp_grpc_client
PRIVATE gRPC::grpc++)

list(APPEND OPENTELEMETRY_OTLP_TARGETS opentelemetry_exporter_otlp_grpc_log)

Expand All @@ -86,8 +88,8 @@ if(WITH_OTLP_GRPC)

target_link_libraries(
opentelemetry_exporter_otlp_grpc_metrics
PUBLIC opentelemetry_otlp_recordable
opentelemetry_exporter_otlp_grpc_client)
PUBLIC opentelemetry_otlp_recordable opentelemetry_exporter_otlp_grpc_client
PRIVATE gRPC::grpc++)

list(APPEND OPENTELEMETRY_OTLP_TARGETS
opentelemetry_exporter_otlp_grpc_metrics)
Expand All @@ -100,8 +102,8 @@ if(WITH_OTLP_HTTP)
PROPERTIES EXPORT_NAME otlp_http_client)
target_link_libraries(
opentelemetry_exporter_otlp_http_client
PUBLIC opentelemetry_common opentelemetry_sdk opentelemetry_proto opentelemetry_http_client_curl
nlohmann_json::nlohmann_json)
PUBLIC opentelemetry_common opentelemetry_sdk opentelemetry_proto
opentelemetry_http_client_curl nlohmann_json::nlohmann_json)
if(nlohmann_json_clone)
add_dependencies(opentelemetry_exporter_otlp_http_client
nlohmann_json::nlohmann_json)
Expand Down

0 comments on commit 38d0fb3

Please sign in to comment.