Skip to content

Commit 4cef852

Browse files
committed
fix default case to include all components in the package
1 parent bd6685d commit 4cef852

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmake/opentelemetry-cpp-config.cmake.in

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,20 @@ set(_OPENTELEMETRY_CPP_TARGETS
158158

159159
set(_FIND_ALL_COMPONENTS TRUE)
160160

161+
set(_OPENTELEMETRY_CPP_REQUESTED_COMPONENTS)
162+
161163
if(NOT DEFINED opentelemetry-cpp_FIND_COMPONENTS OR opentelemetry-cpp_FIND_COMPONENTS STREQUAL "")
162164
# if no components are requested then find all installed components
163-
set(_OPENTELEMETRY_CPP_REQUESTED_COMPONENTS ${_OPENTELEMETRY_CPP_COMPONENTS})
165+
166+
set(_TARGET_FILES_DIR "${CMAKE_CURRENT_LIST_DIR}")
167+
168+
foreach(_COMPONENT IN LISTS _OPENTELEMETRY_CPP_COMPONENTS)
169+
set(_COMPONENT_TARGET_FILE "${_TARGET_FILES_DIR}/opentelemetry-cpp-${_COMPONENT}-target.cmake")
170+
if(EXISTS "${_COMPONENT_TARGET_FILE}")
171+
list(APPEND _OPENTELEMETRY_CPP_REQUESTED_COMPONENTS ${_COMPONENT})
172+
endif()
173+
endforeach()
174+
164175
else()
165176
set(_FIND_ALL_COMPONENTS FALSE)
166177
# check that the requested components are valid and installed

0 commit comments

Comments
 (0)