diff --git a/exporters/fluentd/README.md b/exporters/fluentd/README.md index 3969e6fe5..b250b9fc6 100644 --- a/exporters/fluentd/README.md +++ b/exporters/fluentd/README.md @@ -34,6 +34,21 @@ For example: $ .../opentelemetry-cpp-contrib2/exporters/fluentd$ make ``` +### Incorporating into an existing CMake Project + +To use the library from a CMake project, you can locate it directly with + `find_package` and use the imported targets from generated package + configurations. As of now, this will import targets for both `trace` and `logs`. + +```cmake +# CMakeLists.txt +find_package(opentelemetry-cpp CONFIG REQUIRED) +find_package(opentelemetry-fluentd CONFIG REQUIRED) +... +target_include_directories(foo PRIVATE ${OPENTELEMETRY_CPP_FLUENTD_INCLUDE_DIRS}) +target_link_libraries(foo PRIVATE ${OPENTELEMETRY_CPP_LIBRARIES} ${OPENTELEMETRY_CPP_FLUENTD_LIBRARY_DIRS}) +``` + ### Bazel Install Instructions TODO diff --git a/exporters/fluentd/cmake/opentelemetry-cpp-fluentd-config.cmake.in b/exporters/fluentd/cmake/opentelemetry-cpp-fluentd-config.cmake.in index 46ec892a1..9cc50c976 100644 --- a/exporters/fluentd/cmake/opentelemetry-cpp-fluentd-config.cmake.in +++ b/exporters/fluentd/cmake/opentelemetry-cpp-fluentd-config.cmake.in @@ -19,8 +19,8 @@ # OPENTELEMETRY_CPP_FLUENTD_VERSION - Version of opentelemetry-cpp-fluentd. # # :: -# opentelemetry-cpp-fluentd::trace - Imported target of opentelemetry-cpp-fluentd::trace -# opentelemetry-cpp::logs - Imported target of opentelemetry-cpp-fluentd::logs +# opentelemetry-cpp-fluentd::trace - Imported target of opentelemetry-fluentd::trace +# opentelemetry-cpp::logs - Imported target of opentelemetry-fluentd::logs # ============================================================================= # Copyright 2020 opentelemetry. @@ -49,8 +49,8 @@ set(_OPENTELEMETRY_CPP_FLUENTD_LIBRARIES_TEST_TARGETS logs) foreach(_TEST_TARGET IN LISTS _OPENTELEMETRY_CPP_FLUENTD_LIBRARIES_TEST_TARGETS) - if(TARGET opentelemetry-fluentd-cpp::${_TEST_TARGET}) - list(APPEND OPENTELEMETRY_CPP_FLUENTD_LIBRARIES opentelemetry-cpp-fluentd::${_TEST_TARGET}) + if(TARGET opentelemetry-fluentd::${_TEST_TARGET}) + list(APPEND OPENTELEMETRY_CPP_FLUENTD_LIBRARIES opentelemetry-fluentd::${_TEST_TARGET}) else() message("Target not found: " ${_TEST_TARGET}) endif()