Skip to content

Commit 9fe0333

Browse files
committed
fix(testing_util): link opentelemetry-cpp SDK as PUBLIC
The `opentelemetry_matchers.h` public header of `google_cloud_cpp_testing` includes and uses opentelemetry-cpp SDK symbols inline (e.g. `sdk::trace::SpanData::GetAttributes()`). Tests that link `google_cloud_cpp_testing` therefore reference these SDK symbols directly from their own translation units. However, the CMake build links `opentelemetry-cpp::in_memory_span_exporter` and `opentelemetry-cpp::trace` as PRIVATE, so they are not propagated to the test executables. When building with shared libraries this fails to link, e.g.: undefined reference to symbol '...sdk::trace::SpanData::GetAttributes[abi:cxx11]() const' libopentelemetry_trace.so: error adding symbols: DSO missing from command line The Bazel build already exposes these dependencies transitively (via `google_cloud_cpp_testing_private`), so making the CMake link PUBLIC also aligns the two build systems.
1 parent cf931ff commit 9fe0333

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

google/cloud/testing_util/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ add_library(
5858
target_link_libraries(
5959
google_cloud_cpp_testing
6060
PUBLIC absl::symbolize absl::failure_signal_handler google-cloud-cpp::common
61-
GTest::gmock
62-
PRIVATE opentelemetry-cpp::in_memory_span_exporter opentelemetry-cpp::trace)
61+
GTest::gmock opentelemetry-cpp::in_memory_span_exporter
62+
opentelemetry-cpp::trace)
6363

6464
google_cloud_cpp_add_common_options(google_cloud_cpp_testing)
6565

0 commit comments

Comments
 (0)