Skip to content

Commit

Permalink
[Metrics SDK] Change Prometheus CMake target name (#1765)
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb authored Nov 12, 2022
1 parent b157216 commit 389b84f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion examples/prometheus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ include_directories(${CMAKE_SOURCE_DIR}/exporters/prometheus/include)
add_executable(prometheus_example main.cc)
target_link_libraries(
prometheus_example ${CMAKE_THREAD_LIBS_INIT} opentelemetry_metrics
prometheus_exporter opentelemetry_resources common_metrics_foo_library)
opentelemetry_exporter_prometheus opentelemetry_resources
common_metrics_foo_library)
12 changes: 6 additions & 6 deletions exporters/prometheus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ if(NOT TARGET prometheus-cpp::core)
find_package(prometheus-cpp CONFIG REQUIRED)
endif()

add_library(prometheus_exporter src/exporter.cc src/collector.cc
src/exporter_utils.cc)
add_library(opentelemetry_exporter_prometheus src/exporter.cc src/collector.cc
src/exporter_utils.cc)
target_include_directories(
prometheus_exporter
opentelemetry_exporter_prometheus
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
"$<INSTALL_INTERFACE:include>")

set(PROMETHEUS_EXPORTER_TARGETS prometheus_exporter)
set(PROMETHEUS_EXPORTER_TARGETS opentelemetry_exporter_prometheus)
if(TARGET pull)
list(APPEND PROMETHEUS_EXPORTER_TARGETS pull)
endif()
if(TARGET core)
list(APPEND PROMETHEUS_EXPORTER_TARGETS core)
endif()
target_link_libraries(
prometheus_exporter PUBLIC opentelemetry_metrics prometheus-cpp::pull
prometheus-cpp::core)
opentelemetry_exporter_prometheus
PUBLIC opentelemetry_metrics prometheus-cpp::pull prometheus-cpp::core)
install(
TARGETS ${PROMETHEUS_EXPORTER_TARGETS}
EXPORT "${PROJECT_NAME}-target"
Expand Down
3 changes: 2 additions & 1 deletion exporters/prometheus/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ foreach(testname exporter_test collector_test exporter_utils_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
prometheus_exporter prometheus-cpp::pull opentelemetry_resources)
opentelemetry_exporter_prometheus prometheus-cpp::pull
opentelemetry_resources)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX exporter.
Expand Down

0 comments on commit 389b84f

Please sign in to comment.