1
0
mirror of https://github.com/coturn/coturn.git synced 2025-12-25 09:51:37 +01:00
coturn/cmake/FindPrometheus.cmake
Alex Gustafsson d63704c72d
Implement custom prometheus http handler (#1591)
Implement a custom prometheus http handler in order to:

1. Support listening on a specified address as opposed to any
2. Remove the requirement on the unmaintained promhttp library

This feature comes with one limitation: if an IPv4 address is used, the
server will not listen on the IPv6-mapped address, even if IPv6 is
available. That is, dual-stacking does not work.

Solves: #1475

---------

Co-authored-by: Pavel Punsky <eakraly@users.noreply.github.com>
2024-12-10 10:28:43 -08:00

58 lines
1.7 KiB
CMake

# Author: Kang Lin (kl222@126.com)
#
# Find Prometheus.
#
# Set this variable to any additional path you want the module to search:
# Prometheus_DIR or Prometheus_ROOT
#
# Try to find prometheus
# Once done, this will define:
# Prometheus_FOUND - Prometheus (or all requested components of prom, microhttpd) was found.
# Prometheus_INCLUDE_DIRS - Libevent include directories
# Prometheus_LIBRARIES - libraries needed to use Prometheus
#
include(FindPackageHandleStandardArgs)
find_package(PkgConfig)
pkg_check_modules(PC_prom QUIET prom)
pkg_check_modules(PC_microhttd QUIET microhttpd)
find_path(microhttpd_include_dir
NAMES microhttpd.h
HINTS ${Prometheus_DIR} ${Prometheus_ROOT} ${PC_microhttd_INCLUDE_DIRS} /usr
PATHS $ENV{Prometheus_DIR} $ENV{Prometheus_ROOT}
PATH_SUFFIXES include
)
find_library(
microhttpd_libs
NAMES microhttpd
HINTS ${Prometheus_DIR} ${Prometheus_ROOT} ${PC_microhttd_LIBRARY_DIRS}
PATHS $ENV{Prometheus_DIR} $ENV{Prometheus_ROOT}
PATH_SUFFIXES lib ${CMAKE_INSTALL_LIBDIR})
find_path(prom_INCLUDE_DIR
NAMES prom.h
HINTS ${Prometheus_DIR} ${Prometheus_ROOT} ${PC_prom_INCLUDE_DIRS} /usr
PATHS $ENV{Prometheus_DIR} $ENV{Prometheus_ROOT}
PATH_SUFFIXES include
)
find_library(
prom_libs
NAMES prom
HINTS ${Prometheus_DIR} ${Prometheus_ROOT} ${PC_prom_LIBRARY_DIRS}
PATHS $ENV{Prometheus_DIR} $ENV{Prometheus_ROOT}
PATH_SUFFIXES lib ${CMAKE_INSTALL_LIBDIR})
find_package_handle_standard_args(Prometheus
REQUIRED_VARS prom_libs prom_INCLUDE_DIR
microhttpd_include_dir microhttpd_libs
)
set(Prometheus_INCLUDE_DIRS
${prom_INCLUDE_DIR}
${microhttpd_include_dir})
set(Prometheus_LIBRARIES ${prom_libs} ${microhttpd_libs})