From 454e63b1007bed51449e4771261cf206b97936ef Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Fri, 3 Jul 2026 10:20:31 -0400 Subject: [PATCH 1/2] remove feature to add external components to the opentelemetry-cpp CMake build using environment variables in favor or users building external components with opentelemetry-cpp as a dependency imported through find_package or FetchContent --- ...entelemetry-build-external-component.cmake | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/cmake/opentelemetry-build-external-component.cmake b/cmake/opentelemetry-build-external-component.cmake index 74b6515209..611d6c0162 100644 --- a/cmake/opentelemetry-build-external-component.cmake +++ b/cmake/opentelemetry-build-external-component.cmake @@ -14,10 +14,8 @@ endfunction() # The config options are # - OPENTELEMETRY_EXTERNAL_COMPONENT_PATH - Setting local paths of the external # component as env variable. Multiple paths can be set by separating them with. -# - OPENTELEMETRY_EXTERNAL_COMPONENT_URL Setting github-repo of external component -# as env variable -# Add custom vendor component from local path, or GitHub repo +# Add custom vendor component from local 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 @@ -26,24 +24,4 @@ if(OPENTELEMETRY_EXTERNAL_COMPONENT_PATH) get_directory_name_in_path(${DIR} EXTERNAL_EXPORTER_DIR_NAME) add_subdirectory(${DIR} ${PROJECT_BINARY_DIR}/external/${EXTERNAL_EXPORTER_DIR_NAME}) endforeach() -elseif(DEFINED ENV{OPENTELEMETRY_EXTERNAL_COMPONENT_PATH}) - # Add custom component path to build tree and consolidate binary artifacts in - # current project binary output directory. - set(OPENTELEMETRY_EXTERNAL_COMPONENT_PATH_VAR $ENV{OPENTELEMETRY_EXTERNAL_COMPONENT_PATH}) - foreach(DIR IN LISTS OPENTELEMETRY_EXTERNAL_COMPONENT_PATH_VAR) - get_directory_name_in_path(${DIR} EXTERNAL_EXPORTER_DIR_NAME) - add_subdirectory(${DIR} ${PROJECT_BINARY_DIR}/external/${EXTERNAL_EXPORTER_DIR_NAME}) - endforeach() -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() From fc024e87116e72e0a1b93148c59049dcbe138e64 Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Fri, 3 Jul 2026 10:46:42 -0400 Subject: [PATCH 2/2] Adds a message if the external component is added. Clean up comments to remove env var support --- cmake/opentelemetry-build-external-component.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/opentelemetry-build-external-component.cmake b/cmake/opentelemetry-build-external-component.cmake index 611d6c0162..44b291349f 100644 --- a/cmake/opentelemetry-build-external-component.cmake +++ b/cmake/opentelemetry-build-external-component.cmake @@ -13,11 +13,12 @@ endfunction() # Enable building external components through otel-cpp build # The config options are # - OPENTELEMETRY_EXTERNAL_COMPONENT_PATH - Setting local paths of the external -# component as env variable. Multiple paths can be set by separating them with. +# component. Multiple paths can be set by separating them with. # Add custom vendor component from local path -# Prefer CMake option, then env variable, then URL. +# CMake option. if(OPENTELEMETRY_EXTERNAL_COMPONENT_PATH) + message(STATUS "Building external components from local path(s): ${OPENTELEMETRY_EXTERNAL_COMPONENT_PATH}") # Add custom component path to build tree and consolidate binary artifacts in # current project binary output directory. foreach(DIR IN LISTS OPENTELEMETRY_EXTERNAL_COMPONENT_PATH)