File: CMakeLists.txt

package info (click to toggle)
opentelemetry-cpp 1.23.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,372 kB
  • sloc: cpp: 96,239; sh: 1,766; makefile: 36; python: 31
file content (179 lines) | stat: -rw-r--r-- 6,398 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

if(WITH_OTLP_GRPC)
  # TRACE

  add_executable(example_otlp_grpc grpc_main.cc)

  target_link_libraries(example_otlp_grpc PRIVATE common_foo_library)

  if(DEFINED OPENTELEMETRY_BUILD_DLL)
    target_compile_definitions(example_otlp_grpc
                               PRIVATE OPENTELEMETRY_BUILD_IMPORT_DLL)
    target_link_libraries(example_otlp_grpc
                          PRIVATE opentelemetry-cpp::opentelemetry_cpp)
  else()
    target_link_libraries(example_otlp_grpc
                          PRIVATE opentelemetry-cpp::otlp_grpc_exporter)
  endif()

  # METRIC

  add_executable(example_otlp_grpc_metric grpc_metric_main.cc)

  target_link_libraries(example_otlp_grpc_metric
                        PRIVATE common_metrics_foo_library)

  if(DEFINED OPENTELEMETRY_BUILD_DLL)
    target_compile_definitions(example_otlp_grpc_metric
                               PRIVATE OPENTELEMETRY_BUILD_IMPORT_DLL)
    target_link_libraries(example_otlp_grpc_metric
                          PRIVATE opentelemetry-cpp::opentelemetry_cpp)
  else()
    target_link_libraries(example_otlp_grpc_metric
                          PRIVATE opentelemetry-cpp::otlp_grpc_metrics_exporter)
  endif()

  # LOG

  add_executable(example_otlp_grpc_log grpc_log_main.cc)

  target_link_libraries(example_otlp_grpc_log PRIVATE common_logs_foo_library)
  if(DEFINED OPENTELEMETRY_BUILD_DLL)
    target_compile_definitions(example_otlp_grpc_log
                               PRIVATE OPENTELEMETRY_BUILD_IMPORT_DLL)
    target_link_libraries(example_otlp_grpc_log
                          PRIVATE opentelemetry-cpp::opentelemetry_cpp)
  else()
    target_link_libraries(
      example_otlp_grpc_log
      PRIVATE opentelemetry-cpp::otlp_grpc_exporter
              opentelemetry-cpp::otlp_grpc_log_record_exporter)
  endif()
endif()

if(WITH_OTLP_HTTP)
  # TRACE

  add_executable(example_otlp_http http_main.cc)

  target_link_libraries(example_otlp_http PRIVATE common_foo_library)
  if(DEFINED OPENTELEMETRY_BUILD_DLL)
    target_compile_definitions(example_otlp_http
                               PRIVATE OPENTELEMETRY_BUILD_IMPORT_DLL)
    target_link_libraries(example_otlp_http
                          PRIVATE opentelemetry-cpp::opentelemetry_cpp)
  else()
    target_link_libraries(example_otlp_http
                          PRIVATE opentelemetry-cpp::otlp_http_exporter)
  endif()

  # METRIC

  add_executable(example_otlp_http_metric http_metric_main.cc)
  target_link_libraries(example_otlp_http_metric
                        PRIVATE common_metrics_foo_library)

  if(DEFINED OPENTELEMETRY_BUILD_DLL)
    target_compile_definitions(example_otlp_http_metric
                               PRIVATE OPENTELEMETRY_BUILD_IMPORT_DLL)
    target_link_libraries(example_otlp_http_metric
                          PRIVATE opentelemetry-cpp::opentelemetry_cpp)
  else()
    target_link_libraries(example_otlp_http_metric
                          PRIVATE opentelemetry-cpp::otlp_http_metric_exporter)
  endif()

  # LOG

  add_executable(example_otlp_http_log http_log_main.cc)
  target_link_libraries(example_otlp_http_log PRIVATE common_logs_foo_library)

  if(DEFINED OPENTELEMETRY_BUILD_DLL)
    target_compile_definitions(example_otlp_http_log
                               PRIVATE OPENTELEMETRY_BUILD_IMPORT_DLL)
    target_link_libraries(example_otlp_http_log
                          PRIVATE opentelemetry-cpp::opentelemetry_cpp)
  else()
    target_link_libraries(
      example_otlp_http_log
      PRIVATE opentelemetry-cpp::otlp_http_exporter
              opentelemetry-cpp::otlp_http_log_record_exporter)
  endif()

  # ALL, instrumented

  add_executable(example_otlp_instrumented_http http_instrumented_main.cc)

  # Note: common_logs_foo_library provide traces and logs
  target_link_libraries(
    example_otlp_instrumented_http PRIVATE common_metrics_foo_library
                                           common_logs_foo_library)

  if(DEFINED OPENTELEMETRY_BUILD_DLL)
    target_compile_definitions(example_otlp_instrumented_http
                               PRIVATE OPENTELEMETRY_BUILD_IMPORT_DLL)
    target_link_libraries(example_otlp_instrumented_http
                          PRIVATE opentelemetry-cpp::opentelemetry_cpp)
  else()
    target_link_libraries(
      example_otlp_instrumented_http
      PRIVATE opentelemetry-cpp::otlp_http_exporter
              opentelemetry-cpp::otlp_http_metric_exporter
              opentelemetry-cpp::otlp_http_log_record_exporter)
  endif()

endif()

if(WITH_OTLP_FILE)
  # TRACE

  add_executable(example_otlp_file file_main.cc)

  target_link_libraries(example_otlp_file PRIVATE common_foo_library)

  if(DEFINED OPENTELEMETRY_BUILD_DLL)
    target_compile_definitions(example_otlp_file
                               PRIVATE OPENTELEMETRY_BUILD_IMPORT_DLL)
    target_link_libraries(example_otlp_file
                          PRIVATE opentelemetry-cpp::opentelemetry_cpp)
  else()
    target_link_libraries(example_otlp_file
                          PRIVATE opentelemetry-cpp::otlp_file_exporter)
  endif()

  # METRIC

  add_executable(example_otlp_file_metric file_metric_main.cc)

  target_link_libraries(example_otlp_file_metric
                        PRIVATE common_metrics_foo_library)

  if(DEFINED OPENTELEMETRY_BUILD_DLL)
    target_compile_definitions(example_otlp_file_metric
                               PRIVATE OPENTELEMETRY_BUILD_IMPORT_DLL)
    target_link_libraries(example_otlp_file_metric
                          PRIVATE opentelemetry-cpp::opentelemetry_cpp)
  else()
    target_link_libraries(example_otlp_file_metric
                          PRIVATE opentelemetry-cpp::otlp_file_metric_exporter)
  endif()

  # LOG

  add_executable(example_otlp_file_log file_log_main.cc)

  target_link_libraries(example_otlp_file_log PRIVATE common_logs_foo_library)
  if(DEFINED OPENTELEMETRY_BUILD_DLL)
    target_compile_definitions(example_otlp_file_log
                               PRIVATE OPENTELEMETRY_BUILD_IMPORT_DLL)
    target_link_libraries(example_otlp_file_log
                          PRIVATE opentelemetry-cpp::opentelemetry_cpp)
  else()
    target_link_libraries(
      example_otlp_file_log
      PRIVATE opentelemetry-cpp::otlp_file_exporter
              opentelemetry-cpp::otlp_file_log_record_exporter)
  endif()
endif()