forked from open-telemetry/opentelemetry-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
104 lines (84 loc) · 2.78 KB
/
CMakeLists.txt
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
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
add_library(opentelemetry_api INTERFACE)
target_include_directories(
opentelemetry_api
INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<INSTALL_INTERFACE:include>")
set_target_properties(opentelemetry_api PROPERTIES EXPORT_NAME api)
if(OPENTELEMETRY_INSTALL)
install(
TARGETS opentelemetry_api
EXPORT "${PROJECT_NAME}-target"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
set(LOGS_EXCLUDE_PATTERN "")
if(NOT WITH_LOGS_PREVIEW)
set(LOGS_EXCLUDE_PATTERN "logs")
endif()
install(
DIRECTORY include/opentelemetry
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
PATTERN "metrics" EXCLUDE)
install(
DIRECTORY include/opentelemetry
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
PATTERN "${LOGS_EXCLUDE_PATTERN}" EXCLUDE)
endif()
if(BUILD_TESTING)
add_subdirectory(test)
endif()
if(WITH_NO_DEPRECATED_CODE)
target_compile_definitions(opentelemetry_api
INTERFACE OPENTELEMETRY_NO_DEPRECATED_CODE)
endif()
if(WITH_ABSEIL)
find_package(absl CONFIG REQUIRED)
target_compile_definitions(opentelemetry_api INTERFACE HAVE_ABSEIL)
target_link_libraries(
opentelemetry_api INTERFACE absl::bad_variant_access absl::any absl::base
absl::bits absl::city)
endif()
if(WITH_STL)
message("Building with standard library types...")
target_compile_definitions(opentelemetry_api INTERFACE HAVE_CPP_STDLIB)
else()
message("Building with nostd types...")
endif()
if(WITH_GSL)
target_compile_definitions(opentelemetry_api INTERFACE HAVE_GSL)
# Guidelines Support Library path. Used if we are not on not get C++20.
#
find_package(Microsoft.GSL QUIET)
if(TARGET Microsoft.GSL::GSL)
target_link_libraries(opentelemetry_api INTERFACE Microsoft.GSL::GSL)
else()
set(GSL_DIR third_party/ms-gsl)
target_include_directories(
opentelemetry_api INTERFACE "$<BUILD_INTERFACE:${GSL_DIR}/include>")
endif()
endif()
if(WITH_LOGS_PREVIEW)
target_compile_definitions(opentelemetry_api INTERFACE ENABLE_LOGS_PREVIEW)
endif()
if(WITH_NO_GETENV)
target_compile_definitions(opentelemetry_api INTERFACE NO_GETENV)
endif()
if(WIN32)
target_compile_definitions(opentelemetry_api INTERFACE NOMINMAX)
if(WITH_ETW)
target_compile_definitions(opentelemetry_api INTERFACE HAVE_MSGPACK)
endif()
endif()
if(WITH_ASYNC_EXPORT_PREVIEW)
target_compile_definitions(opentelemetry_api INTERFACE ENABLE_ASYNC_EXPORT)
endif()
if(WITH_METRICS_EXEMPLAR_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_METRICS_EXEMPLAR_PREVIEW)
endif()