File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,19 +159,21 @@ There are two approaches to incoporate `opentelemetry-cpp` into
1591591 . Build and install ` opentelemetry-cpp ` then use ` find_package `
160160 to import its targets
161161
162+ Example instrumentation library (using only the OTel C++ API)
163+
162164 ``` cmake
163- # Find all installed components and link all imported targets
164165 find_package(opentelemetry-cpp CONFIG REQUIRED)
165166 ...
166- target_include_directories(foo PRIVATE ${OPENTELEMETRY_CPP_INCLUDE_DIRS})
167- target_link_libraries(foo PRIVATE ${OPENTELEMETRY_CPP_LIBRARIES} )
167+ # Link just the API header only interface target
168+ target_link_libraries(foo_lib PRIVATE opentelemetry-cpp::api )
168169 ```
169170
171+ Example application (using the OTel C++ SDK and exporters)
172+
170173 ``` cmake
171- # Find a specific component and link its imported target(s)
172- find_package(opentelemetry-cpp CONFIG REQUIRED COMPONENTS api)
174+ find_package(opentelemetry-cpp CONFIG REQUIRED)
173175 ...
174- target_link_libraries(foo PRIVATE opentelemetry-cpp::api )
176+ target_link_libraries(foo_app PRIVATE opentelemetry-cpp::trace opentelemetry-cpp::ostream_span_exporter )
175177 ```
176178
1771792 . Use CMake's [ FetchContent] ( https://cmake.org/cmake/help/latest/module/FetchContent.html )
@@ -192,7 +194,7 @@ There are two approaches to incoporate `opentelemetry-cpp` into
192194 FetchContent_Declare(
193195 opentelemetry-cpp
194196 GIT_REPOSITORY https://github.com/open-telemetry/opentelemetry-cpp.git
195- GIT_TAG v1.20.0 )
197+ GIT_TAG <release tag or SHA> )
196198 FetchContent_MakeAvailable(opentelemetry-cpp)
197199 ...
198200 target_link_libraries(foo PRIVATE opentelemetry-cpp::api)
You can’t perform that action at this time.
0 commit comments