Skip to content

Commit 313b04d

Browse files
authored
[BUILD] Fix if check on environment variable and add CMake variable (open-telemetry#2207)
1 parent efde010 commit 313b04d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cmake/opentelemetry-build-external-component.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@
88
# - OPENTELEMETRY_EXTERNAL_COMPONENT_URL Setting github-repo of external component
99
# as env variable
1010

11-
1211
# Add custom vendor component from local path, or GitHub repo
13-
if(DEFINED $ENV{OPENTELEMETRY_EXTERNAL_COMPONENT_PATH})
12+
# Prefer CMake option, then env variable, then URL.
13+
if(OPENTELEMETRY_EXTERNAL_COMPONENT_PATH)
14+
# Add custom component path to build tree and consolidate binary artifacts in
15+
# current project binary output directory.
16+
add_subdirectory(${OPENTELEMETRY_EXTERNAL_COMPONENT_PATH}
17+
${PROJECT_BINARY_DIR}/external)
18+
elseif(DEFINED ENV{OPENTELEMETRY_EXTERNAL_COMPONENT_PATH})
1419
# Add custom component path to build tree and consolidate binary artifacts in
1520
# current project binary output directory.
1621
add_subdirectory($ENV{OPENTELEMETRY_EXTERNAL_COMPONENT_PATH}

0 commit comments

Comments
 (0)