summaryrefslogtreecommitdiffstats
path: root/src/jaegertracing/opentelemetry-cpp/cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/jaegertracing/opentelemetry-cpp/cmake
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/jaegertracing/opentelemetry-cpp/cmake')
-rw-r--r--src/jaegertracing/opentelemetry-cpp/cmake/modules/FindThrift.cmake31
-rw-r--r--src/jaegertracing/opentelemetry-cpp/cmake/nlohmann-json.cmake42
-rw-r--r--src/jaegertracing/opentelemetry-cpp/cmake/opentelemetry-cpp-config.cmake.in111
-rw-r--r--src/jaegertracing/opentelemetry-cpp/cmake/opentelemetry-proto.cmake247
-rw-r--r--src/jaegertracing/opentelemetry-cpp/cmake/proto-options-patch.cmake116
5 files changed, 547 insertions, 0 deletions
diff --git a/src/jaegertracing/opentelemetry-cpp/cmake/modules/FindThrift.cmake b/src/jaegertracing/opentelemetry-cpp/cmake/modules/FindThrift.cmake
new file mode 100644
index 000000000..c7baf07f0
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/cmake/modules/FindThrift.cmake
@@ -0,0 +1,31 @@
+# This module defines Thrift_LIBRARIES, libraries to link Thrift_INCLUDE_DIR,
+# Thrift_FOUND, If false, do not try to use it.
+
+# prefer the Thrift version supplied in Thrift_HOME (cmake -DThrift_HOME then
+# environment)
+find_path(
+ Thrift_INCLUDE_DIR
+ NAMES thrift/Thrift.h
+ HINTS ${Thrift_HOME} ENV Thrift_HOME /usr/local /opt/local
+ PATH_SUFFIXES include)
+
+# prefer the Thrift version supplied in Thrift_HOME
+find_library(
+ Thrift_LIBRARIES
+ NAMES thrift libthrift
+ HINTS ${Thrift_HOME} ENV Thrift_HOME /usr/local /opt/local
+ PATH_SUFFIXES lib lib64)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Thrift DEFAULT_MSG Thrift_LIBRARIES
+ Thrift_INCLUDE_DIR)
+mark_as_advanced(Thrift_LIBRARIES Thrift_INCLUDE_DIR)
+
+
+if(Thrift_FOUND AND NOT (TARGET thrift::thrift))
+ add_library(thrift::thrift UNKNOWN IMPORTED)
+ set_target_properties(
+ thrift::thrift
+ PROPERTIES IMPORTED_LOCATION ${Thrift_LIBRARIES}
+ INTERFACE_INCLUDE_DIRECTORIES ${Thrift_INCLUDE_DIR})
+endif()
diff --git a/src/jaegertracing/opentelemetry-cpp/cmake/nlohmann-json.cmake b/src/jaegertracing/opentelemetry-cpp/cmake/nlohmann-json.cmake
new file mode 100644
index 000000000..b5b4355e4
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/cmake/nlohmann-json.cmake
@@ -0,0 +1,42 @@
+if("${nlohmann-json}" STREQUAL "")
+ set(nlohmann-json "develop")
+endif()
+include(ExternalProject)
+ExternalProject_Add(nlohmann_json_download
+ PREFIX third_party
+ GIT_REPOSITORY https://github.com/nlohmann/json.git
+ GIT_TAG
+ "${nlohmann-json}"
+ UPDATE_COMMAND ""
+ CMAKE_ARGS
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
+ -DJSON_BuildTests=OFF
+ -DJSON_Install=ON
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+ TEST_AFTER_INSTALL
+ 0
+ DOWNLOAD_NO_PROGRESS
+ 1
+ LOG_CONFIGURE
+ 1
+ LOG_BUILD
+ 1
+ LOG_INSTALL
+ 1
+)
+
+ExternalProject_Get_Property(nlohmann_json_download INSTALL_DIR)
+SET(NLOHMANN_JSON_INCLUDE_DIR ${INSTALL_DIR}/src/nlohmann_json_download/single_include)
+add_library(nlohmann_json_ INTERFACE)
+target_include_directories(nlohmann_json_ INTERFACE
+ "$<BUILD_INTERFACE:${NLOHMANN_JSON_INCLUDE_DIR}>"
+ "$<INSTALL_INTERFACE:include>")
+add_dependencies(nlohmann_json_ nlohmann_json_download)
+add_library(nlohmann_json::nlohmann_json ALIAS nlohmann_json_)
+
+install(
+ TARGETS nlohmann_json_
+ EXPORT "${PROJECT_NAME}-target"
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
diff --git a/src/jaegertracing/opentelemetry-cpp/cmake/opentelemetry-cpp-config.cmake.in b/src/jaegertracing/opentelemetry-cpp/cmake/opentelemetry-cpp-config.cmake.in
new file mode 100644
index 000000000..34549d468
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/cmake/opentelemetry-cpp-config.cmake.in
@@ -0,0 +1,111 @@
+#.rst:
+# opentelemetry-cpp-config.cmake
+# --------
+#
+# Find the native opentelemetry-cpp includes and library.
+#
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# 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::api - Imported target of opentelemetry-cpp::api
+# opentelemetry-cpp::sdk - Imported target of opentelemetry-cpp::sdk
+# opentelemetry-cpp::ext - Imported target of opentelemetry-cpp::ext
+# opentelemetry-cpp::version - Imported target of opentelemetry-cpp::version
+# opentelemetry-cpp::common - Imported target of opentelemetry-cpp::common
+# opentelemetry-cpp::trace - Imported target of opentelemetry-cpp::trace
+# opentelemetry-cpp::metrics - Imported target of opentelemetry-cpp::metrics
+# opentelemetry-cpp::logs - Imported target of opentelemetry-cpp::logs
+# opentelemetry-cpp::in_memory_span_exporter - Imported target of opentelemetry-cpp::in_memory_span_exporter
+# opentelemetry-cpp::otlp_recordable - Imported target of opentelemetry-cpp::otlp_recordable
+# opentelemetry-cpp::otlp_grpc_exporter - Imported target of opentelemetry-cpp::otlp_grpc_exporter
+# opentelemetry-cpp::otlp_grpc_log_exporter - Imported target of opentelemetry-cpp::otlp_grpc_log_exporter
+# opentelemetry-cpp::otlp_http_client - Imported target of opentelemetry-cpp::otlp_http_client
+# opentelemetry-cpp::otlp_http_exporter - Imported target of opentelemetry-cpp::otlp_http_exporter
+# opentelemetry-cpp::otlp_http_log_exporter - Imported target of opentelemetry-cpp::otlp_http_log_exporter
+# opentelemetry-cpp::ostream_log_exporter - Imported target of opentelemetry-cpp::ostream_log_exporter
+# opentelemetry-cpp::ostream_metrics_exporter - Imported target of opentelemetry-cpp::ostream_metrics_exporter
+# opentelemetry-cpp::ostream_span_exporter - Imported target of opentelemetry-cpp::ostream_span_exporter
+# opentelemetry-cpp::prometheus_exporter_deprecated - Imported target of opentelemetry-cpp::prometheus_exporter_deprecated
+# opentelemetry-cpp::elasticsearch_log_exporter - Imported target of opentelemetry-cpp::elasticsearch_log_exporter
+# opentelemetry-cpp::etw_exporter - Imported target of opentelemetry-cpp::etw_exporter
+# opentelemetry-cpp::jaeger_trace_exporter - Imported target of opentelemetry-cpp::jaeger_trace_exporter
+# opentelemetry-cpp::zpages - Imported target of opentelemetry-cpp::zpages
+# opentelemetry-cpp::http_client_curl - Imported target of opentelemetry-cpp::http_client_curl
+#
+
+# =============================================================================
+# Copyright 2020 opentelemetry.
+#
+# Distributed under the Apache License (the "License"); see accompanying file
+# LICENSE for details.
+# =============================================================================
+
+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@
+
+# ##############################################################################
+
+find_package(Threads)
+
+set_and_check(OPENTELEMETRY_CPP_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR@")
+set_and_check(OPENTELEMETRY_CPP_LIBRARY_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
+
+include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-target.cmake")
+
+set(OPENTELEMETRY_CPP_LIBRARIES)
+set(_OPENTELEMETRY_CPP_LIBRARIES_TEST_TARGETS
+ api
+ sdk
+ ext
+ version
+ common
+ trace
+ metrics
+ logs
+ in_memory_span_exporter
+ otlp_recordable
+ otlp_grpc_exporter
+ otlp_http_client
+ otlp_http_exporter
+ otlp_http_log_exporter
+ ostream_log_exporter
+ ostream_metrics_exporter
+ ostream_span_exporter
+ prometheus_exporter
+ elasticsearch_log_exporter
+ etw_exporter
+ jaeger_trace_exporter
+ zpages
+ http_client_curl)
+foreach(_TEST_TARGET IN LISTS _OPENTELEMETRY_CPP_LIBRARIES_TEST_TARGETS)
+ if(TARGET opentelemetry-cpp::${_TEST_TARGET})
+ list(APPEND OPENTELEMETRY_CPP_LIBRARIES opentelemetry-cpp::${_TEST_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")
+find_package_handle_standard_args(
+ ${CMAKE_FIND_PACKAGE_NAME}
+ FOUND_VAR ${CMAKE_FIND_PACKAGE_NAME}_FOUND
+ REQUIRED_VARS OPENTELEMETRY_CPP_INCLUDE_DIRS OPENTELEMETRY_CPP_LIBRARIES)
diff --git a/src/jaegertracing/opentelemetry-cpp/cmake/opentelemetry-proto.cmake b/src/jaegertracing/opentelemetry-cpp/cmake/opentelemetry-proto.cmake
new file mode 100644
index 000000000..37d45da6c
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/cmake/opentelemetry-proto.cmake
@@ -0,0 +1,247 @@
+if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git)
+ set(PROTO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")
+ set(needs_proto_download FALSE)
+else()
+ if("${opentelemetry-proto}" STREQUAL "")
+ set(opentelemetry-proto "v0.17.0")
+ endif()
+ include(ExternalProject)
+ ExternalProject_Add(
+ opentelemetry-proto
+ GIT_REPOSITORY https://github.com/open-telemetry/opentelemetry-proto.git
+ GIT_TAG "${opentelemetry-proto}"
+ UPDATE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ CONFIGURE_COMMAND ""
+ TEST_AFTER_INSTALL 0
+ DOWNLOAD_NO_PROGRESS 1
+ LOG_CONFIGURE 1
+ LOG_BUILD 1
+ LOG_INSTALL 1)
+ ExternalProject_Get_Property(opentelemetry-proto INSTALL_DIR)
+ set(PROTO_PATH "${INSTALL_DIR}/src/opentelemetry-proto")
+ set(needs_proto_download TRUE)
+endif()
+
+include(${PROJECT_SOURCE_DIR}/cmake/proto-options-patch.cmake)
+
+set(COMMON_PROTO "${PROTO_PATH}/opentelemetry/proto/common/v1/common.proto")
+set(RESOURCE_PROTO
+ "${PROTO_PATH}/opentelemetry/proto/resource/v1/resource.proto")
+set(TRACE_PROTO "${PROTO_PATH}/opentelemetry/proto/trace/v1/trace.proto")
+set(LOGS_PROTO "${PROTO_PATH}/opentelemetry/proto/logs/v1/logs.proto")
+set(METRICS_PROTO "${PROTO_PATH}/opentelemetry/proto/metrics/v1/metrics.proto")
+
+set(TRACE_SERVICE_PROTO
+ "${PROTO_PATH}/opentelemetry/proto/collector/trace/v1/trace_service.proto")
+set(LOGS_SERVICE_PROTO
+ "${PROTO_PATH}/opentelemetry/proto/collector/logs/v1/logs_service.proto")
+set(METRICS_SERVICE_PROTO
+ "${PROTO_PATH}/opentelemetry/proto/collector/metrics/v1/metrics_service.proto"
+)
+
+set(GENERATED_PROTOBUF_PATH
+ "${CMAKE_BINARY_DIR}/generated/third_party/opentelemetry-proto")
+
+file(MAKE_DIRECTORY "${GENERATED_PROTOBUF_PATH}")
+
+set(COMMON_PB_CPP_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/common/v1/common.pb.cc")
+set(COMMON_PB_H_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/common/v1/common.pb.h")
+set(RESOURCE_PB_CPP_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/resource/v1/resource.pb.cc")
+set(RESOURCE_PB_H_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/resource/v1/resource.pb.h")
+set(TRACE_PB_CPP_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/trace/v1/trace.pb.cc")
+set(TRACE_PB_H_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/trace/v1/trace.pb.h")
+set(LOGS_PB_CPP_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/logs/v1/logs.pb.cc")
+set(LOGS_PB_H_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/logs/v1/logs.pb.h")
+set(METRICS_PB_CPP_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/metrics/v1/metrics.pb.cc")
+set(METRICS_PB_H_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/metrics/v1/metrics.pb.h")
+
+set(TRACE_SERVICE_PB_CPP_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/collector/trace/v1/trace_service.pb.cc"
+)
+set(TRACE_SERVICE_PB_H_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/collector/trace/v1/trace_service.pb.h"
+)
+if(WITH_OTLP_GRPC)
+ set(TRACE_SERVICE_GRPC_PB_CPP_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.cc"
+ )
+ set(TRACE_SERVICE_GRPC_PB_H_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h"
+ )
+endif()
+set(LOGS_SERVICE_PB_CPP_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/collector/logs/v1/logs_service.pb.cc"
+)
+set(LOGS_SERVICE_PB_H_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/collector/logs/v1/logs_service.pb.h"
+)
+if(WITH_OTLP_GRPC)
+ set(LOGS_SERVICE_GRPC_PB_CPP_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.cc"
+ )
+ set(LOGS_SERVICE_GRPC_PB_H_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/collector/logs/v1/logs_service.grpc.pb.h"
+ )
+endif()
+set(METRICS_SERVICE_PB_CPP_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/collector/metrics/v1/metrics_service.pb.cc"
+)
+set(METRICS_SERVICE_PB_H_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/collector/metrics/v1/metrics_service.pb.h"
+)
+if(WITH_OTLP_GRPC)
+ set(METRICS_SERVICE_GRPC_PB_CPP_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.cc"
+ )
+ set(METRICS_SERVICE_GRPC_PB_H_FILE
+ "${GENERATED_PROTOBUF_PATH}/opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.h"
+ )
+endif()
+
+foreach(IMPORT_DIR ${PROTOBUF_IMPORT_DIRS})
+ list(APPEND PROTOBUF_INCLUDE_FLAGS "-I${IMPORT_DIR}")
+endforeach()
+
+if(WITH_OTLP_GRPC)
+ if(CMAKE_CROSSCOMPILING)
+ find_program(gRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
+ else()
+ if(TARGET gRPC::grpc_cpp_plugin)
+ project_build_tools_get_imported_location(gRPC_CPP_PLUGIN_EXECUTABLE
+ gRPC::grpc_cpp_plugin)
+ else()
+ find_program(gRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
+ endif()
+ endif()
+ message(STATUS "gRPC_CPP_PLUGIN_EXECUTABLE=${gRPC_CPP_PLUGIN_EXECUTABLE}")
+endif()
+
+if(WITH_OTLP_GRPC)
+ add_custom_command(
+ OUTPUT ${COMMON_PB_H_FILE}
+ ${COMMON_PB_CPP_FILE}
+ ${RESOURCE_PB_H_FILE}
+ ${RESOURCE_PB_CPP_FILE}
+ ${TRACE_PB_H_FILE}
+ ${TRACE_PB_CPP_FILE}
+ ${LOGS_PB_H_FILE}
+ ${LOGS_PB_CPP_FILE}
+ ${METRICS_PB_H_FILE}
+ ${METRICS_PB_CPP_FILE}
+ ${TRACE_SERVICE_PB_H_FILE}
+ ${TRACE_SERVICE_PB_CPP_FILE}
+ ${TRACE_SERVICE_GRPC_PB_H_FILE}
+ ${TRACE_SERVICE_GRPC_PB_CPP_FILE}
+ ${LOGS_SERVICE_PB_H_FILE}
+ ${LOGS_SERVICE_PB_CPP_FILE}
+ ${LOGS_SERVICE_GRPC_PB_H_FILE}
+ ${LOGS_SERVICE_GRPC_PB_CPP_FILE}
+ ${METRICS_SERVICE_PB_H_FILE}
+ ${METRICS_SERVICE_PB_CPP_FILE}
+ ${METRICS_SERVICE_GRPC_PB_H_FILE}
+ ${METRICS_SERVICE_GRPC_PB_CPP_FILE}
+ COMMAND
+ ${PROTOBUF_PROTOC_EXECUTABLE} ARGS "--experimental_allow_proto3_optional"
+ "--proto_path=${PROTO_PATH}" ${PROTOBUF_INCLUDE_FLAGS}
+ "--cpp_out=${GENERATED_PROTOBUF_PATH}"
+ "--grpc_out=generate_mock_code=true:${GENERATED_PROTOBUF_PATH}"
+ --plugin=protoc-gen-grpc="${gRPC_CPP_PLUGIN_EXECUTABLE}" ${COMMON_PROTO}
+ ${RESOURCE_PROTO} ${TRACE_PROTO} ${LOGS_PROTO} ${METRICS_PROTO}
+ ${TRACE_SERVICE_PROTO} ${LOGS_SERVICE_PROTO} ${METRICS_SERVICE_PROTO})
+else()
+ add_custom_command(
+ OUTPUT ${COMMON_PB_H_FILE}
+ ${COMMON_PB_CPP_FILE}
+ ${RESOURCE_PB_H_FILE}
+ ${RESOURCE_PB_CPP_FILE}
+ ${TRACE_PB_H_FILE}
+ ${TRACE_PB_CPP_FILE}
+ ${LOGS_PB_H_FILE}
+ ${LOGS_PB_CPP_FILE}
+ ${METRICS_PB_H_FILE}
+ ${METRICS_PB_CPP_FILE}
+ ${TRACE_SERVICE_PB_H_FILE}
+ ${TRACE_SERVICE_PB_CPP_FILE}
+ ${LOGS_SERVICE_PB_H_FILE}
+ ${LOGS_SERVICE_PB_CPP_FILE}
+ ${METRICS_SERVICE_PB_H_FILE}
+ ${METRICS_SERVICE_PB_CPP_FILE}
+ COMMAND
+ ${PROTOBUF_PROTOC_EXECUTABLE} ARGS "--experimental_allow_proto3_optional"
+ "--proto_path=${PROTO_PATH}" ${PROTOBUF_INCLUDE_FLAGS}
+ "--cpp_out=${GENERATED_PROTOBUF_PATH}" ${COMMON_PROTO} ${RESOURCE_PROTO}
+ ${TRACE_PROTO} ${LOGS_PROTO} ${METRICS_PROTO} ${TRACE_SERVICE_PROTO}
+ ${LOGS_SERVICE_PROTO} ${METRICS_SERVICE_PROTO})
+endif()
+
+include_directories("${GENERATED_PROTOBUF_PATH}")
+
+if(WITH_OTLP_GRPC)
+ add_library(
+ opentelemetry_proto STATIC
+ ${COMMON_PB_CPP_FILE}
+ ${RESOURCE_PB_CPP_FILE}
+ ${TRACE_PB_CPP_FILE}
+ ${LOGS_PB_CPP_FILE}
+ ${METRICS_PB_CPP_FILE}
+ ${TRACE_SERVICE_PB_CPP_FILE}
+ ${TRACE_SERVICE_GRPC_PB_CPP_FILE}
+ ${LOGS_SERVICE_PB_CPP_FILE}
+ ${LOGS_SERVICE_GRPC_PB_CPP_FILE}
+ ${METRICS_SERVICE_PB_CPP_FILE}
+ ${METRICS_SERVICE_GRPC_PB_CPP_FILE})
+else()
+ add_library(
+ opentelemetry_proto STATIC
+ ${COMMON_PB_CPP_FILE}
+ ${RESOURCE_PB_CPP_FILE}
+ ${TRACE_PB_CPP_FILE}
+ ${LOGS_PB_CPP_FILE}
+ ${METRICS_PB_CPP_FILE}
+ ${TRACE_SERVICE_PB_CPP_FILE}
+ ${LOGS_SERVICE_PB_CPP_FILE}
+ ${METRICS_SERVICE_PB_CPP_FILE})
+endif()
+
+if(needs_proto_download)
+ add_dependencies(opentelemetry_proto opentelemetry-proto)
+endif()
+set_target_properties(opentelemetry_proto PROPERTIES EXPORT_NAME proto)
+patch_protobuf_targets(opentelemetry_proto)
+
+install(
+ TARGETS opentelemetry_proto
+ EXPORT "${PROJECT_NAME}-target"
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+install(
+ DIRECTORY ${GENERATED_PROTOBUF_PATH}/opentelemetry
+ DESTINATION include
+ FILES_MATCHING
+ PATTERN "*.h")
+
+if(TARGET protobuf::libprotobuf)
+ target_link_libraries(opentelemetry_proto PUBLIC protobuf::libprotobuf)
+else() # cmake 3.8 or lower
+ target_include_directories(opentelemetry_proto
+ PUBLIC ${Protobuf_INCLUDE_DIRS})
+ target_link_libraries(opentelemetry_proto INTERFACE ${Protobuf_LIBRARIES})
+endif()
+
+if(BUILD_SHARED_LIBS)
+ set_property(TARGET opentelemetry_proto PROPERTY POSITION_INDEPENDENT_CODE ON)
+endif()
diff --git a/src/jaegertracing/opentelemetry-cpp/cmake/proto-options-patch.cmake b/src/jaegertracing/opentelemetry-cpp/cmake/proto-options-patch.cmake
new file mode 100644
index 000000000..ed294ea79
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/cmake/proto-options-patch.cmake
@@ -0,0 +1,116 @@
+macro(check_append_cxx_compiler_flag OUTPUT_VAR)
+ foreach(CHECK_FLAG ${ARGN})
+ check_cxx_compiler_flag(${CHECK_FLAG}
+ "check_cxx_compiler_flag_${CHECK_FLAG}")
+ if(check_cxx_compiler_flag_${CHECK_FLAG})
+ list(APPEND ${OUTPUT_VAR} ${CHECK_FLAG})
+ endif()
+ endforeach()
+endmacro()
+
+if(NOT PATCH_PROTOBUF_SOURCES_OPTIONS_SET)
+ if(MSVC)
+ unset(PATCH_PROTOBUF_SOURCES_OPTIONS CACHE)
+ set(PATCH_PROTOBUF_SOURCES_OPTIONS /wd4244 /wd4251 /wd4267 /wd4309)
+
+ if(MSVC_VERSION GREATER_EQUAL 1922)
+ # see
+ # https://docs.microsoft.com/en-us/cpp/overview/cpp-conformance-improvements?view=vs-2019#improvements_162
+ # for detail
+ list(APPEND PATCH_PROTOBUF_SOURCES_OPTIONS /wd5054)
+ endif()
+
+ if(MSVC_VERSION GREATER_EQUAL 1925)
+ list(APPEND PATCH_PROTOBUF_SOURCES_OPTIONS /wd4996)
+ endif()
+
+ if(MSVC_VERSION LESS 1910)
+ list(APPEND PATCH_PROTOBUF_SOURCES_OPTIONS /wd4800)
+ endif()
+ else()
+ unset(PATCH_PROTOBUF_SOURCES_OPTIONS CACHE)
+ include(CheckCXXCompilerFlag)
+ check_append_cxx_compiler_flag(
+ PATCH_PROTOBUF_SOURCES_OPTIONS -Wno-type-limits
+ -Wno-deprecated-declarations -Wno-unused-parameter)
+ endif()
+ set(PATCH_PROTOBUF_SOURCES_OPTIONS_SET TRUE)
+ if(PATCH_PROTOBUF_SOURCES_OPTIONS)
+ set(PATCH_PROTOBUF_SOURCES_OPTIONS
+ ${PATCH_PROTOBUF_SOURCES_OPTIONS}
+ CACHE INTERNAL
+ "Options to disable warning of generated protobuf sources" FORCE)
+ endif()
+endif()
+
+function(patch_protobuf_sources)
+ if(PATCH_PROTOBUF_SOURCES_OPTIONS)
+ foreach(PROTO_SRC ${ARGN})
+ unset(PROTO_SRC_OPTIONS)
+ get_source_file_property(PROTO_SRC_OPTIONS ${PROTO_SRC} COMPILE_OPTIONS)
+ if(PROTO_SRC_OPTIONS)
+ list(APPEND PROTO_SRC_OPTIONS ${PATCH_PROTOBUF_SOURCES_OPTIONS})
+ else()
+ set(PROTO_SRC_OPTIONS ${PATCH_PROTOBUF_SOURCES_OPTIONS})
+ endif()
+
+ set_source_files_properties(
+ ${PROTO_SRC} PROPERTIES COMPILE_OPTIONS "${PROTO_SRC_OPTIONS}")
+ endforeach()
+ unset(PROTO_SRC)
+ unset(PROTO_SRC_OPTIONS)
+ endif()
+endfunction()
+
+function(patch_protobuf_targets)
+ if(PATCH_PROTOBUF_SOURCES_OPTIONS)
+ foreach(PROTO_TARGET ${ARGN})
+ unset(PROTO_TARGET_OPTIONS)
+ get_target_property(PROTO_TARGET_OPTIONS ${PROTO_TARGET} COMPILE_OPTIONS)
+ if(PROTO_TARGET_OPTIONS)
+ list(APPEND PROTO_TARGET_OPTIONS ${PATCH_PROTOBUF_SOURCES_OPTIONS})
+ else()
+ set(PROTO_TARGET_OPTIONS ${PATCH_PROTOBUF_SOURCES_OPTIONS})
+ endif()
+
+ set_target_properties(
+ ${PROTO_TARGET} PROPERTIES COMPILE_OPTIONS "${PROTO_TARGET_OPTIONS}")
+ endforeach()
+ unset(PROTO_TARGET)
+ unset(PROTO_TARGET_OPTIONS)
+ endif()
+endfunction()
+
+function(project_build_tools_get_imported_location OUTPUT_VAR_NAME TARGET_NAME)
+ if(CMAKE_BUILD_TYPE)
+ string(TOUPPER "IMPORTED_LOCATION_${CMAKE_BUILD_TYPE}"
+ TRY_SPECIFY_IMPORTED_LOCATION)
+ get_target_property(${OUTPUT_VAR_NAME} ${TARGET_NAME}
+ ${TRY_SPECIFY_IMPORTED_LOCATION})
+ endif()
+ if(NOT ${OUTPUT_VAR_NAME})
+ get_target_property(${OUTPUT_VAR_NAME} ${TARGET_NAME} IMPORTED_LOCATION)
+ endif()
+ if(NOT ${OUTPUT_VAR_NAME})
+ get_target_property(
+ project_build_tools_get_imported_location_IMPORTED_CONFIGURATIONS
+ ${TARGET_NAME} IMPORTED_CONFIGURATIONS)
+ foreach(
+ project_build_tools_get_imported_location_IMPORTED_CONFIGURATION IN
+ LISTS project_build_tools_get_imported_location_IMPORTED_CONFIGURATIONS)
+ get_target_property(
+ ${OUTPUT_VAR_NAME}
+ ${TARGET_NAME}
+ "IMPORTED_LOCATION_${project_build_tools_get_imported_location_IMPORTED_CONFIGURATION}"
+ )
+ if(${OUTPUT_VAR_NAME})
+ break()
+ endif()
+ endforeach()
+ endif()
+ if(${OUTPUT_VAR_NAME})
+ set(${OUTPUT_VAR_NAME}
+ ${${OUTPUT_VAR_NAME}}
+ PARENT_SCOPE)
+ endif()
+endfunction()