-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUILD] Enable building otel-cpp extensions from main repo (#1937)
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright The OpenTelemetry Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Enable building external components through otel-cpp build | ||
# The config options are | ||
# - OPENTELEMETRY_EXTERNAL_COMPONENT_PATH - Setting local path of the external | ||
# component as env variable | ||
# - OPENTELEMETRY_EXTERNAL_COMPONENT_URL Setting github-repo of external component | ||
# as env variable | ||
|
||
|
||
# Add custom vendor component from local path, or GitHub repo | ||
if(DEFINED $ENV{OPENTELEMETRY_EXTERNAL_COMPONENT_PATH}) | ||
# Add custom component path to build tree and consolidate binary artifacts in | ||
# current project binary output directory. | ||
add_subdirectory($ENV{OPENTELEMETRY_EXTERNAL_COMPONENT_PATH} | ||
${PROJECT_BINARY_DIR}/external) | ||
elseif(DEFINED $ENV{OPENTELEMETRY_EXTERNAL_COMPONENT_URL}) | ||
# This option requires CMake 3.11+: add standard remote repo to build tree. | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
external | ||
GIT_REPOSITORY $ENV{OPENTELEMETRY_EXTERNAL_COMPONENT_URL} | ||
GIT_TAG "main") | ||
FetchContent_GetProperties(external) | ||
if(NOT external_POPULATED) | ||
FetchContent_Populate(external) | ||
add_subdirectory(${external_SOURCE_DIR}) | ||
endif() | ||
endif() |