Skip to content

Commit 6292a6a

Browse files
tobimmarcalfflalitb
authored
[INSTALL] Resolve dependencies in opentelemetry-cpp-config.cmake (open-telemetry#3094)
* 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`. * Add find_dependency calls for remaining deps Now we also resolve `OpenTracing`, and `prometheus-cpp`. If necessary, `CURL` and `ZLIB` are also resolved. --------- Co-authored-by: Marc Alff <[email protected]> Co-authored-by: Lalit Kumar Bhasin <[email protected]>
1 parent 5e62859 commit 6292a6a

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

cmake/opentelemetry-cpp-config.cmake.in

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,39 @@ 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("@OpenTracing_FOUND@")
86+
find_dependency(OpenTracing)
87+
endif()
88+
89+
if("@prometheus-cpp_FOUND@")
90+
find_dependency(prometheus-cpp)
91+
endif()
92+
93+
if("@Protobuf_FOUND@" OR "@PROTOBUF_FOUND@")
94+
find_dependency(Protobuf)
95+
endif()
96+
97+
if (@WITH_HTTP_CLIENT_CURL@ AND NOT @BUILD_SHARED_LIBS@)
98+
if("@CURL_FOUND@")
99+
find_dependency(CURL)
100+
endif()
101+
102+
if("@ZLIB_FOUND@")
103+
find_dependency(ZLIB)
104+
endif()
105+
endif()
74106

75107
set_and_check(OPENTELEMETRY_CPP_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")
76108
set_and_check(OPENTELEMETRY_CPP_LIBRARY_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")

0 commit comments

Comments
 (0)