forked from trpc-ecosystem/cpp-telemetry-opentelemetry
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcom_github_opentelemetry_cpp.cmake
More file actions
62 lines (53 loc) · 2.36 KB
/
Copy pathcom_github_opentelemetry_cpp.cmake
File metadata and controls
62 lines (53 loc) · 2.36 KB
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
#
#
# Tencent is pleased to support the open source community by making tRPC available.
#
# Copyright (C) 2023 Tencent.
# All rights reserved.
#
# If you have downloaded a copy of the tRPC source code from Tencent,
# please note that tRPC source code is licensed under the Apache 2.0 License,
# A copy of the Apache 2.0 License is included in this file.
#
#
include(FetchContent)
set(OPEN_TELEMETRY_TAG v1.9.1)
set(OPEN_TELEMETRY_URL https://github.com/open-telemetry/opentelemetry-cpp/archive/${OPEN_TELEMETRY_TAG}.tar.gz)
FetchContent_Declare(
com_github_opentelemetry_cpp
URL ${OPEN_TELEMETRY_URL}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake_third_party/com_github_opentelemetry_cpp
)
FetchContent_GetProperties(com_github_opentelemetry_cpp)
if(NOT com_github_opentelemetry_cpp_POPULATED)
FetchContent_Populate(com_github_opentelemetry_cpp)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(WITH_OTLP ON)
set(WITH_OTLP_HTTP ON)
set(WITH_EXAMPLES OFF)
set(WITH_FUNC_TESTS OFF)
set(BUILD_TESTING OFF)
set(WITH_BENCHMARK OFF)
set(WITH_LOGS_PREVIEW ON)
# Replace CMakeLists.txt of opentelemetry_cpp to fix some error and use protoc build for trpc-cpp
execute_process(
COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/cmake/tools/opentelemetry_cpp_CMakeLists.txt ${com_github_opentelemetry_cpp_SOURCE_DIR}/CMakeLists.txt
WORKING_DIRECTORY ${com_github_opentelemetry_cpp_SOURCE_DIR}
)
add_subdirectory(${com_github_opentelemetry_cpp_SOURCE_DIR})
endif()
set(TARGET_INCLUDE_PATHS ${TARGET_INCLUDE_PATHS}
${com_github_opentelemetry_cpp_SOURCE_DIR}/api/include
${com_github_opentelemetry_cpp_SOURCE_DIR}/sdk/include
${com_github_opentelemetry_cpp_SOURCE_DIR}/ext/include
${com_github_opentelemetry_cpp_SOURCE_DIR}/exporters/otlp/include)
set(TARGET_LINK_LIBS ${TARGET_LINK_LIBS}
opentelemetry_sdk
opentelemetry_api
opentelemetry_trace
opentelemetry_ext
opentelemetry_otlp_recordable
opentelemetry_exporter_otlp_http_client
opentelemetry_exporter_otlp_http
opentelemetry_exporter_otlp_http_log
opentelemetry_exporter_otlp_http_metric)