From fc4decf5b34a5ed27a79a3fd3a7593a1909cc6e5 Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Wed, 28 Jun 2023 14:01:41 -0700 Subject: [PATCH] Fix if check on environment variable and add CMake variable --- cmake/opentelemetry-build-external-component.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/opentelemetry-build-external-component.cmake b/cmake/opentelemetry-build-external-component.cmake index cd30eb082f..2d8d78afbf 100644 --- a/cmake/opentelemetry-build-external-component.cmake +++ b/cmake/opentelemetry-build-external-component.cmake @@ -8,9 +8,14 @@ # - 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}) +# Prefer CMake option, then env variable, then URL. +if(OPENTELEMETRY_EXTERNAL_COMPONENT_PATH) + # Add custom component path to build tree and consolidate binary artifacts in + # current project binary output directory. + add_subdirectory(${OPENTELEMETRY_EXTERNAL_COMPONENT_PATH} + ${PROJECT_BINARY_DIR}/external) +elseif(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}