|
1 | | -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git) |
2 | | - set(PROTO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto") |
| 1 | +# Copyright The OpenTelemetry Authors |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +# |
| 5 | +# The dependency on opentelemetry-proto can be provided different ways. |
| 6 | +# By order of decreasing priority, options are: |
| 7 | +# |
| 8 | +# 1 - Use a provided package |
| 9 | +# |
| 10 | +# This is useful to build opentelemetry-cpp as part of a super project. |
| 11 | +# |
| 12 | +# The super project provides the path to the opentelemetry-proto |
| 13 | +# source code using variable ${OTELCPP_PROTO_PATH} |
| 14 | +# |
| 15 | +# 2 - Search for a opentelemetry-proto git submodule |
| 16 | +# |
| 17 | +# When git submodule is used, |
| 18 | +# the opentelemetry-proto code is located in: |
| 19 | +# third_party/opentelemetry-proto |
| 20 | +# |
| 21 | +# 3 - Download opentelemetry-proto from github |
| 22 | +# |
| 23 | +# Code from the required version is used, |
| 24 | +# unless a specific release tag is provided |
| 25 | +# in variable ${opentelemetry-proto} |
| 26 | +# |
| 27 | + |
| 28 | +if(OTELCPP_PROTO_PATH) |
| 29 | + if(NOT EXISTS(${OTELCPP_PROTO_PATH}/opentelemetry/proto/common/v1/common.proto)) |
| 30 | + message(FATAL_ERROR "OTELCPP_PROTO_PATH does not point to a opentelemetry-proto repository") |
| 31 | + endif() |
| 32 | + message(STATUS "opentelemetry-proto dependency satisfied by: external path") |
| 33 | + set(PROTO_PATH ${OTELCPP_PROTO_PATH}) |
3 | 34 | set(needs_proto_download FALSE) |
4 | 35 | else() |
5 | | - if("${opentelemetry-proto}" STREQUAL "") |
6 | | - set(opentelemetry-proto "v0.19.0") |
| 36 | + if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git) |
| 37 | + message(STATUS "opentelemetry-proto dependency satisfied by: git submodule") |
| 38 | + set(PROTO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto") |
| 39 | + set(needs_proto_download FALSE) |
| 40 | + else() |
| 41 | + message(STATUS "opentelemetry-proto dependency satisfied by: github download") |
| 42 | + if("${opentelemetry-proto}" STREQUAL "") |
| 43 | + set(opentelemetry-proto "v0.19.0") |
| 44 | + endif() |
| 45 | + include(ExternalProject) |
| 46 | + ExternalProject_Add( |
| 47 | + opentelemetry-proto |
| 48 | + GIT_REPOSITORY https://github.com/open-telemetry/opentelemetry-proto.git |
| 49 | + GIT_TAG "${opentelemetry-proto}" |
| 50 | + UPDATE_COMMAND "" |
| 51 | + BUILD_COMMAND "" |
| 52 | + INSTALL_COMMAND "" |
| 53 | + CONFIGURE_COMMAND "" |
| 54 | + TEST_AFTER_INSTALL 0 |
| 55 | + DOWNLOAD_NO_PROGRESS 1 |
| 56 | + LOG_CONFIGURE 1 |
| 57 | + LOG_BUILD 1 |
| 58 | + LOG_INSTALL 1) |
| 59 | + ExternalProject_Get_Property(opentelemetry-proto INSTALL_DIR) |
| 60 | + set(PROTO_PATH "${INSTALL_DIR}/src/opentelemetry-proto") |
| 61 | + set(needs_proto_download TRUE) |
7 | 62 | endif() |
8 | | - include(ExternalProject) |
9 | | - ExternalProject_Add( |
10 | | - opentelemetry-proto |
11 | | - GIT_REPOSITORY https://github.com/open-telemetry/opentelemetry-proto.git |
12 | | - GIT_TAG "${opentelemetry-proto}" |
13 | | - UPDATE_COMMAND "" |
14 | | - BUILD_COMMAND "" |
15 | | - INSTALL_COMMAND "" |
16 | | - CONFIGURE_COMMAND "" |
17 | | - TEST_AFTER_INSTALL 0 |
18 | | - DOWNLOAD_NO_PROGRESS 1 |
19 | | - LOG_CONFIGURE 1 |
20 | | - LOG_BUILD 1 |
21 | | - LOG_INSTALL 1) |
22 | | - ExternalProject_Get_Property(opentelemetry-proto INSTALL_DIR) |
23 | | - set(PROTO_PATH "${INSTALL_DIR}/src/opentelemetry-proto") |
24 | | - set(needs_proto_download TRUE) |
25 | 63 | endif() |
26 | 64 |
|
27 | 65 | include(${PROJECT_SOURCE_DIR}/cmake/proto-options-patch.cmake) |
|
0 commit comments