Skip to content

Commit 6252f46

Browse files
committed
Resolve dependencies in opentelemetry-cpp-config.cmake
Before this change, consumers of the exported CMake targets had to know which dependencies are needed to get the transitive target dependencies like `absl::*`, `gRPC::grpc++`, or `protobuf::libprotobuf`.
1 parent 6445819 commit 6252f46

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

cmake/opentelemetry-cpp-config.cmake.in

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,21 @@ set(OPENTELEMETRY_VERSION
7070

7171
# ##############################################################################
7272

73-
find_package(Threads)
73+
include(CMakeFindDependencyMacro)
74+
75+
find_dependency(Threads)
76+
77+
if(@WITH_ABSEIL@)
78+
find_dependency(absl)
79+
endif()
80+
81+
if(@WITH_OTLP_GRPC@)
82+
find_dependency(gRPC)
83+
endif()
84+
85+
if("@Protobuf_FOUND@" OR "@PROTOBUF_FOUND@")
86+
find_dependency(Protobuf)
87+
endif()
7488

7589
set_and_check(OPENTELEMETRY_CPP_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")
7690
set_and_check(OPENTELEMETRY_CPP_LIBRARY_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")

0 commit comments

Comments
 (0)