-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[INSTALL] add cmake components to the package #3220
base: main
Are you sure you want to change the base?
[INSTALL] add cmake components to the package #3220
Conversation
✅ Deploy Preview for opentelemetry-cpp-api-docs canceled.
|
Posting this as draft and seeking feedback. Interested in thoughts/concerns on the general approach and the proposed component to target mapping. If the proposed changes look reasonable, I'd be happy to add the ci tests to verify the changes. |
Hi @owent , could you take a look at this change ? Thanks. |
@@ -12,6 +12,9 @@ target_include_directories( | |||
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>" | |||
"$<INSTALL_INTERFACE:include>") | |||
|
|||
set_target_properties(opentelemetry_exporter_zipkin_trace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The EXPORT_NAME property is set for all other installed targets, so setting here for the zipkin target.
|
||
set(OPENTELEMETRY_CPP_LIBRARIES) | ||
set(_OPENTELEMETRY_CPP_LIBRARIES_TEST_TARGETS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This list has been renamed to _OPENTELEMETRY_CPP_TARGETS above and the following targets have been added:
resources
- Existing target of the sdkin_memory_metric_exporter
- Existing target of exporters/memoryzipkin_trace_exporter
- New EXPORT_NAME for the existingopentelemetry_exporter_zipkin_trace
target
@owent This is still a draft but I'm interested in your feedback before I go too much further. Here is a brief summary of work remaining and some open questions. Work remaining:
Some open questions:
|
# List all possible opentelemetry-cpp component targets. Some may not be supported by this install | ||
|
||
|
||
set(_OPENTELEMETRY_CPP_COMPONENTS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will likely move the components list and targets list to separate cmake files that can be included here. This along with a file that defines the component to component dependencies and component to thirdparty package dependencies will be helpful in testing.
@@ -774,17 +774,6 @@ if(OPENTELEMETRY_INSTALL) | |||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}/${PROJECT_NAME}-config-version.cmake" | |||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") | |||
|
|||
# Export all components | |||
export( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This export of the target file to the current binary directory appears unused and I've removed it. The PR only installs the target files for the components in the install directory.
Fixes #3218
Overview
This PR introduces CMake COMPONENTS to the
opentelemetry-cpp
package. Components are essentially named groups of CMake targets and can be passed to thefind_package
function to more selectively include targets and dependencies.For example, with this PR the following will only include the
opentelemetry-cpp::api
header only target and search for no other dependencies that may be needed by other targets of the package.Using components like this provides developers more control over what targets and dependencies CMake includes and should help reduce the scope of dependency issues a developer may encounter when building their instrumented CMake projects against different versions/configurations of the installed
opentelemetry-cpp
package.Please see the updated
INSTALL.md
file of this PR for the proposed components to targets mapping.Backwards compatibility is covered by including all components and finding all dependencies when the developer does not pass any components to find_package as in the case below.
Changes
opentelemetry-cpp-target.cmake
file into target files per component by updating the CMakeinstall
commands that create export sets in the CMakeLists.txt files for each of the targets.opentelemetry-cpp-config.cmake
to include a complete list of all components and all targets. This file now reacts to theopentelemetry-cpp_FIND_COMPONENTS
list set byfind_package
when a developer adds theCOMPONENTS
arguments.For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes