|
| 1 | +# Copyright The OpenTelemetry Authors |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +if(DEFINED OPENTELEMETRY_BUILD_DLL) |
| 5 | + add_definitions(-DOPENTELEMETRY_BUILD_IMPORT_DLL) |
| 6 | +endif() |
| 7 | + |
| 8 | +add_executable( |
| 9 | + example_yaml |
| 10 | + main.cc |
| 11 | + custom_sampler.cc |
| 12 | + custom_sampler_builder.cc |
| 13 | + custom_span_exporter.cc |
| 14 | + custom_span_exporter_builder.cc |
| 15 | + custom_span_processor.cc |
| 16 | + custom_span_processor_builder.cc |
| 17 | + custom_push_metric_exporter.cc |
| 18 | + custom_push_metric_exporter_builder.cc |
| 19 | + custom_pull_metric_exporter.cc |
| 20 | + custom_pull_metric_exporter_builder.cc |
| 21 | + custom_log_record_exporter.cc |
| 22 | + custom_log_record_exporter_builder.cc |
| 23 | + custom_log_record_processor.cc |
| 24 | + custom_log_record_processor_builder.cc) |
| 25 | + |
| 26 | +target_link_libraries( |
| 27 | + example_yaml ${CMAKE_THREAD_LIBS_INIT} |
| 28 | + PRIVATE common_metrics_foo_library |
| 29 | + common_logs_foo_library |
| 30 | + opentelemetry-cpp::ostream_span_exporter_builder |
| 31 | + opentelemetry-cpp::ostream_metrics_exporter_builder |
| 32 | + opentelemetry-cpp::ostream_log_record_exporter_builder) |
| 33 | + |
| 34 | +if(WITH_OTLP_HTTP) |
| 35 | + add_definitions(-DOTEL_HAVE_OTLP_HTTP) |
| 36 | + target_link_libraries( |
| 37 | + example_yaml |
| 38 | + PRIVATE opentelemetry-cpp::otlp_http_exporter_builder |
| 39 | + opentelemetry-cpp::otlp_http_log_record_exporter_builder |
| 40 | + opentelemetry-cpp::otlp_http_metric_exporter_builder) |
| 41 | +endif() |
| 42 | + |
| 43 | +if(WITH_OTLP_GRPC) |
| 44 | + add_definitions(-DOTEL_HAVE_OTLP_GRPC) |
| 45 | + target_link_libraries( |
| 46 | + example_yaml |
| 47 | + PRIVATE opentelemetry-cpp::otlp_grpc_exporter_builder |
| 48 | + opentelemetry-cpp::otlp_grpc_log_record_exporter_builder |
| 49 | + opentelemetry-cpp::otlp_grpc_metrics_exporter_builder) |
| 50 | +endif() |
| 51 | + |
| 52 | +if(WITH_OTLP_FILE) |
| 53 | + add_definitions(-DOTEL_HAVE_OTLP_FILE) |
| 54 | + target_link_libraries( |
| 55 | + example_yaml |
| 56 | + PRIVATE opentelemetry-cpp::otlp_file_exporter_builder |
| 57 | + opentelemetry-cpp::otlp_file_log_record_exporter_builder |
| 58 | + opentelemetry-cpp::otlp_file_metric_exporter_builder) |
| 59 | +endif() |
| 60 | + |
| 61 | +if(WITH_ZIPKIN) |
| 62 | + add_definitions(-DOTEL_HAVE_ZIPKIN) |
| 63 | + target_link_libraries( |
| 64 | + example_yaml PRIVATE opentelemetry-cpp::zipkin_trace_exporter_builder) |
| 65 | +endif() |
| 66 | + |
| 67 | +if(WITH_PROMETHEUS) |
| 68 | + add_definitions(-DOTEL_HAVE_PROMETHEUS) |
| 69 | + target_link_libraries(example_yaml |
| 70 | + PRIVATE opentelemetry-cpp::prometheus_exporter_builder) |
| 71 | +endif() |
| 72 | + |
| 73 | +if(DEFINED OPENTELEMETRY_BUILD_DLL) |
| 74 | + target_link_libraries(example_yaml |
| 75 | + PRIVATE opentelemetry-cpp::opentelemetry_cpp) |
| 76 | +else() |
| 77 | + target_link_libraries( |
| 78 | + example_yaml |
| 79 | + PRIVATE opentelemetry-cpp::configuration opentelemetry-cpp::common |
| 80 | + opentelemetry-cpp::trace opentelemetry-cpp::logs) |
| 81 | +endif() |
0 commit comments