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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
#.rst:
# opentelemetry-cpp-config.cmake
# --------
# Finding opentelemetry-cpp in CMake projects
# ========================================
#
# - find_package(opentelemetry-cpp CONFIG REQUIRED) to import all installed targets and dependencies
# - find_package(opentelemetry-cpp CONFIG COMPONENTS ...) to import specific components' targets and dependencies
#
# Example usage
# -------------------
#
# 1. **No Components Specified**
#
# When no components are provided, all components and their targets are imported.
#
# .. code-block:: cmake
#
# find_package(opentelemetry-cpp CONFIG REQUIRED)
#
#
# 2. **Components Specified**
#
# When a component is specified, its third-party dependencies are found;
# then, targets from that component, along with the components on which it depends, are imported.
#
# .. code-block:: cmake
#
# find_package(opentelemetry-cpp CONFIG REQUIRED COMPONENTS exporters_otlp_grpc)
#
#
#.. note::
# To troubleshoot issues with ``find_package(opentelemetry-cpp CONFIG REQUIRED)``, run CMake with debug logging enabled:
#
# .. code-block:: bash
#
# cmake --log-level=DEBUG -S <source_dir> -B <build_dir>
#
# To get more verbose output from CMake’s package search, run CMake with the following flag:
#
# .. code-block:: bash
#
# cmake -DCMAKE_FIND_DEBUG_MODE=ON -S <source_dir> -B <build_dir>
#
#
# CMake Variables Defined
# --------------------
#
# This module defines the following variables:
#
# ::
#
# OPENTELEMETRY_CPP_INCLUDE_DIRS - Include directories of opentelemetry-cpp.
# OPENTELEMETRY_CPP_LIBRARY_DIRS - Link directories of opentelemetry-cpp.
# OPENTELEMETRY_CPP_LIBRARIES - List of libraries when using opentelemetry-cpp.
# OPENTELEMETRY_CPP_FOUND - True if opentelemetry-cpp found.
# OPENTELEMETRY_ABI_VERSION_NO - ABI version of opentelemetry-cpp.
# OPENTELEMETRY_VERSION - Version of opentelemetry-cpp.
# OPENTELEMETRY_CPP_COMPONENTS_INSTALLED - List of components installed.
# opentelemetry-cpp_FOUND - True if opentelemetry-cpp found.
# opentelemetry-cpp_<component>_FOUND - True if the requested component is found.
# ::
#
#
# CMake Components and Targets Supported
# --------------------
# opentelemetry-cpp supports the following components and targets. This install may include a subset.
#
# COMPONENTS
# api
# sdk
# ext_common
# ext_http_curl
# ext_dll
# exporters_in_memory
# exporters_ostream
# exporters_otlp_common
# exporters_otlp_file
# exporters_otlp_grpc
# exporters_otlp_http
# exporters_prometheus
# exporters_elasticsearch
# exporters_etw
# exporters_zipkin
# shims_opentracing
#
# ::
#
# TARGETS
# opentelemetry-cpp::api - Imported target of COMPONENT api
# opentelemetry-cpp::sdk - Imported target of COMPONENT sdk
# opentelemetry-cpp::version - Imported target of COMPONENT sdk
# opentelemetry-cpp::common - Imported target of COMPONENT sdk
# opentelemetry-cpp::resources - Imported target of COMPONENT sdk
# opentelemetry-cpp::trace - Imported target of COMPONENT sdk
# opentelemetry-cpp::metrics - Imported target of COMPONENT sdk
# opentelemetry-cpp::logs - Imported target of COMPONENT sdk
# opentelemetry-cpp::ext - Imported target of COMPONENT ext_common
# opentelemetry-cpp::http_client_curl - Imported target of COMPONENT ext_http_curl
# opentelemetry-cpp::opentelemetry_cpp - Imported target of COMPONENT ext_dll
# opentelemetry-cpp::in_memory_span_exporter - Imported target of COMPONENT exporters_in_memory
# opentelemetry-cpp::in_memory_metric_exporter - Imported target of COMPONENT exporters_in_memory
# opentelemetry-cpp::ostream_log_record_exporter - Imported target of COMPONENT exporters_ostream
# opentelemetry-cpp::ostream_metrics_exporter - Imported target of COMPONENT exporters_ostream
# opentelemetry-cpp::ostream_span_exporter - Imported target of COMPONENT exporters_ostream
# opentelemetry-cpp::proto - Imported target of COMPONENT exporters_otlp_common
# opentelemetry-cpp::otlp_recordable - Imported target of COMPONENT exporters_otlp_common
# opentelemetry-cpp::otlp_file_client - Imported target of COMPONENT exporters_otlp_file
# opentelemetry-cpp::otlp_file_exporter - Imported target of COMPONENT exporters_otlp_file
# opentelemetry-cpp::otlp_file_log_record_exporter - Imported target of COMPONENT exporters_otlp_file
# opentelemetry-cpp::otlp_file_metric_exporter - Imported target of COMPONENT exporters_otlp_file
# opentelemetry-cpp::proto_grpc - Imported target of COMPONENT exporters_otlp_grpc
# opentelemetry-cpp::otlp_grpc_client - Imported target of COMPONENT exporters_otlp_grpc
# opentelemetry-cpp::otlp_grpc_exporter - Imported target of COMPONENT exporters_otlp_grpc
# opentelemetry-cpp::otlp_grpc_log_record_exporter - Imported target of COMPONENT exporters_otlp_grpc
# opentelemetry-cpp::otlp_grpc_metrics_exporter - Imported target of COMPONENT exporters_otlp_grpc
# opentelemetry-cpp::otlp_http_client - Imported target of COMPONENT exporters_otlp_http
# opentelemetry-cpp::otlp_http_exporter - Imported target of COMPONENT exporters_otlp_http
# opentelemetry-cpp::otlp_http_log_record_exporter - Imported target of COMPONENT exporters_otlp_http
# opentelemetry-cpp::otlp_http_metric_exporter - Imported target of COMPONENT exporters_otlp_http
# opentelemetry-cpp::prometheus_exporter - Imported target of COMPONENT exporters_prometheus
# opentelemetry-cpp::elasticsearch_log_record_exporter - Imported target of COMPONENT exporters_elasticsearch
# opentelemetry-cpp::etw_exporter - Imported target of COMPONENT exporters_etw
# opentelemetry-cpp::zipkin_trace_exporter - Imported target of COMPONENT exporters_zipkin
# opentelemetry-cpp::opentracing_shim - Imported target of COMPONENT shims_opentracing
#
# Additional Files Used in Component to Component and Third-Party Dependency Resolution
# --------------------------------------------------------
#
# - **thirdparty-dependency-definitions.cmake**
# This file lists the third-party dependencies supported by opentelemetry-cpp and components that may require them.
# Dependencies are found in the order defined in this file when find_package(opentelemetry-cpp …) is invoked.
#
# **Found using CMake CONFIG search mode:**
#
# - **absl**
# - **nlohmann_json**
# - **Protobuf**
# - **gRPC**
# - **prometheus-cpp**
# - **OpenTracing**
#
# **Found using the CMake MODULE search mode:**
#
# - **Threads**
# - **ZLIB**
# - **CURL**
#
# - **component-definitions.cmake**
# This file defines the available opentelemetry-cpp components, the targets associated with each
# component, and the inter-component dependencies.
#
# =============================================================================
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
# =============================================================================
set(OPENTELEMETRY_ABI_VERSION_NO
"@OPENTELEMETRY_ABI_VERSION_NO@"
CACHE STRING "opentelemetry-cpp ABI version" FORCE)
set(OPENTELEMETRY_VERSION
"@OPENTELEMETRY_VERSION@"
CACHE STRING "opentelemetry-cpp version" FORCE)
@PACKAGE_INIT@
# Include the opentelemetry-cpp file that includes component defintions, thirdparty definitons and functions to support finding this package and dependencies.
include("${CMAKE_CURRENT_LIST_DIR}/find-package-support-functions.cmake")
set(_INSTALLED_COMPONENTS "")
get_installed_components(_INSTALLED_COMPONENTS)
set(OPENTELEMETRY_CPP_COMPONENTS_INSTALLED ${_INSTALLED_COMPONENTS} CACHE STRING "opentelemetry-cpp components installed" FORCE)
set(_REQUESTED_COMPONENTS "")
get_requested_components(_INSTALLED_COMPONENTS _REQUESTED_COMPONENTS)
find_required_dependencies(_REQUESTED_COMPONENTS)
set_and_check(OPENTELEMETRY_CPP_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")
set_and_check(OPENTELEMETRY_CPP_LIBRARY_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
# include the target files selected and set the component found flag
foreach(_COMPONENT IN LISTS _REQUESTED_COMPONENTS)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-${_COMPONENT}-target.cmake")
set(${CMAKE_FIND_PACKAGE_NAME}_${_COMPONENT}_FOUND TRUE
CACHE BOOL "whether ${CMAKE_FIND_PACKAGE_NAME} component ${_COMPONENT} is found" FORCE)
endforeach()
# get installed and requested targets
set(_OPENTELEMETRY_CPP_TARGETS "")
get_targets(_REQUESTED_COMPONENTS _OPENTELEMETRY_CPP_TARGETS)
check_targets_imported(_OPENTELEMETRY_CPP_TARGETS)
# Set OPENTELEMETRY_CPP_* variables
set(OPENTELEMETRY_CPP_LIBRARIES)
set(DLL_TARGET "opentelemetry-cpp::opentelemetry_cpp")
foreach(_TARGET IN LISTS _OPENTELEMETRY_CPP_TARGETS)
if(TARGET "${_TARGET}" AND NOT "${_TARGET}" STREQUAL "${DLL_TARGET}")
list(APPEND OPENTELEMETRY_CPP_LIBRARIES "${_TARGET}")
endif()
endforeach()
# handle the QUIETLY and REQUIRED arguments and set opentelemetry-cpp_FOUND to
# TRUE if all variables listed contain valid results, e.g. valid file paths.
include("FindPackageHandleStandardArgs")
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG ${CMAKE_CURRENT_LIST_FILE})
find_package_handle_standard_args(
${CMAKE_FIND_PACKAGE_NAME}
CONFIG_MODE
REQUIRED_VARS OPENTELEMETRY_CPP_INCLUDE_DIRS OPENTELEMETRY_CPP_LIBRARIES)
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
set(OPENTELEMETRY_CPP_FOUND
${${CMAKE_FIND_PACKAGE_NAME}_FOUND}
CACHE BOOL "whether opentelemetry-cpp is found" FORCE)
else()
unset(OPENTELEMETRY_CPP_FOUND)
unset(OPENTELEMETRY_CPP_FOUND CACHE)
endif()
check_required_components(${CMAKE_FIND_PACKAGE_NAME})
|