-
Notifications
You must be signed in to change notification settings - Fork 425
/
CMakeLists.txt
67 lines (56 loc) · 2.15 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
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
set(this_target opentelemetry_opentracing_shim)
add_library(${this_target} src/shim_utils.cc src/span_shim.cc
src/span_context_shim.cc src/tracer_shim.cc)
set_target_properties(${this_target} PROPERTIES EXPORT_NAME opentracing_shim)
set_target_version(${this_target})
target_include_directories(
${this_target} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<INSTALL_INTERFACE:include>")
if(OPENTRACING_DIR)
target_include_directories(
${this_target}
PUBLIC
"$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/${OPENTRACING_DIR}/include>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/${OPENTRACING_DIR}/include>"
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/${OPENTRACING_DIR}/3rd_party/include>"
)
target_link_libraries(${this_target} opentelemetry_api opentracing)
else()
target_link_libraries(${this_target} opentelemetry_api
OpenTracing::opentracing)
endif()
if(OPENTELEMETRY_INSTALL)
install(
TARGETS ${this_target}
EXPORT "${PROJECT_NAME}-target"
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(
DIRECTORY include/opentelemetry/opentracingshim
DESTINATION include/opentelemetry
FILES_MATCHING
PATTERN "*.h")
endif()
if(BUILD_TESTING)
foreach(testname propagation_test shim_utils_test span_shim_test
span_context_shim_test tracer_shim_test)
add_executable(${testname} "test/${testname}.cc")
if(OPENTRACING_DIR)
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
opentelemetry_api opentelemetry_opentracing_shim opentracing)
else()
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
opentelemetry_api opentelemetry_opentracing_shim
OpenTracing::opentracing)
endif()
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX opentracing_shim.
TEST_LIST ${testname})
endforeach()
endif() # BUILD_TESTING