Skip to content

Commit

Permalink
Provide a CMake target for prometheus_exporter_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
dufferzafar committed Feb 28, 2024
1 parent d036d82 commit eef4fcf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions exporters/prometheus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ target_link_libraries(
opentelemetry_exporter_prometheus
PUBLIC opentelemetry_metrics prometheus-cpp::pull prometheus-cpp::core)

# We create a separate target for utils library
add_library(
opentelemetry_exporter_prometheus_utils
src/exporter_utils.cc)

set_target_properties(opentelemetry_exporter_prometheus_utils
PROPERTIES EXPORT_NAME prometheus_exporter_utils)
set_target_version(opentelemetry_exporter_prometheus_utils)

target_include_directories(
opentelemetry_exporter_prometheus_utils
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<INSTALL_INTERFACE:include>")

list(APPEND PROMETHEUS_EXPORTER_TARGETS opentelemetry_exporter_prometheus_utils)
target_link_libraries(
opentelemetry_exporter_prometheus_utils
PUBLIC opentelemetry_metrics prometheus-cpp::core)

if(OPENTELEMETRY_INSTALL)
install(
TARGETS ${PROMETHEUS_EXPORTER_TARGETS}
Expand Down

0 comments on commit eef4fcf

Please sign in to comment.