Some checks failed
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Failing after 29s
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Failing after 16s
sm-rpc / build (Debug, host.gcc) (push) Failing after 11s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Failing after 12s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Failing after 11s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Failing after 11s
sm-rpc / build (Release, host.gcc) (push) Failing after 12s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Failing after 16s
128 lines
3.1 KiB
CMake
128 lines
3.1 KiB
CMake
if(USE_THIRDPARTY_LIBRARIES)
|
|
find_package(civetweb-3rdparty CONFIG REQUIRED)
|
|
add_library(${PROJECT_NAME}::civetweb ALIAS civetweb)
|
|
install(
|
|
TARGETS civetweb
|
|
EXPORT ${PROJECT_NAME}-targets
|
|
# keep embedded civetweb headers scoped to prometheus(-cpp)
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/prometheus
|
|
)
|
|
else()
|
|
find_package(civetweb CONFIG REQUIRED)
|
|
|
|
# work-around https://github.com/civetweb/civetweb/pull/918
|
|
if(WIN32 AND NOT TARGET WINSOCK::WINSOCK)
|
|
add_library(WINSOCK::WINSOCK INTERFACE IMPORTED)
|
|
target_link_libraries(WINSOCK::WINSOCK INTERFACE ws2_32)
|
|
endif()
|
|
endif()
|
|
|
|
if(ENABLE_COMPRESSION)
|
|
find_package(ZLIB REQUIRED)
|
|
endif()
|
|
|
|
add_library(pull
|
|
src/basic_auth.cc
|
|
src/basic_auth.h
|
|
src/endpoint.cc
|
|
src/endpoint.h
|
|
src/exposer.cc
|
|
src/handler.cc
|
|
src/handler.h
|
|
src/metrics_collector.cc
|
|
src/metrics_collector.h
|
|
)
|
|
|
|
add_library(${PROJECT_NAME}::pull ALIAS pull)
|
|
|
|
target_compile_features(pull
|
|
PUBLIC
|
|
cxx_std_11
|
|
)
|
|
|
|
target_link_libraries(pull
|
|
PUBLIC
|
|
${PROJECT_NAME}::core
|
|
PRIVATE
|
|
${PROJECT_NAME}::util
|
|
Threads::Threads
|
|
$<IF:$<BOOL:${USE_THIRDPARTY_LIBRARIES}>,${PROJECT_NAME}::civetweb,civetweb::civetweb-cpp>
|
|
$<$<AND:$<BOOL:UNIX>,$<NOT:$<BOOL:APPLE>>>:rt>
|
|
$<$<BOOL:${ENABLE_COMPRESSION}>:ZLIB::ZLIB>
|
|
)
|
|
|
|
target_include_directories(pull
|
|
PUBLIC
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
|
PRIVATE
|
|
${CIVETWEB_INCLUDE_DIRS}
|
|
)
|
|
|
|
target_compile_definitions(pull
|
|
PRIVATE
|
|
$<$<BOOL:${ENABLE_COMPRESSION}>:HAVE_ZLIB>
|
|
)
|
|
|
|
set_target_properties(pull
|
|
PROPERTIES
|
|
OUTPUT_NAME ${PROJECT_NAME}-pull
|
|
DEFINE_SYMBOL PROMETHEUS_CPP_PULL_EXPORTS
|
|
VERSION "${PROJECT_VERSION}"
|
|
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
|
|
)
|
|
|
|
generate_export_header(pull
|
|
BASE_NAME ${PROJECT_NAME}-pull
|
|
EXPORT_FILE_NAME include/prometheus/detail/pull_export.h
|
|
)
|
|
|
|
install(
|
|
TARGETS pull
|
|
EXPORT ${PROJECT_NAME}-targets
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
)
|
|
|
|
install(
|
|
DIRECTORY include/ ${CMAKE_CURRENT_BINARY_DIR}/include/
|
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
)
|
|
|
|
if(GENERATE_PKGCONFIG)
|
|
set(PKGCONFIG_LIBS)
|
|
set(PKGCONFIG_REQUIRES)
|
|
|
|
if(NOT USE_THIRDPARTY_LIBRARIES)
|
|
string(APPEND PKGCONFIG_LIBS " -lcivetweb-cpp -lcivetweb")
|
|
endif()
|
|
|
|
if(ENABLE_COMPRESSION)
|
|
string(APPEND PKGCONFIG_REQUIRES " zlib")
|
|
endif()
|
|
|
|
configure_file(
|
|
${PROJECT_SOURCE_DIR}/cmake/prometheus-cpp-pull.pc.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/prometheus-cpp-pull.pc
|
|
@ONLY
|
|
)
|
|
|
|
install(
|
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/prometheus-cpp-pull.pc
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
|
)
|
|
|
|
unset(PKGCONFIG_LIBS)
|
|
unset(PKGCONFIG_REQUIRES)
|
|
endif()
|
|
|
|
if(ENABLE_TESTING)
|
|
add_library(pull_internal_headers INTERFACE)
|
|
add_library(${PROJECT_NAME}::pull_internal_headers ALIAS pull_internal_headers)
|
|
target_include_directories(pull_internal_headers INTERFACE src)
|
|
|
|
add_subdirectory(tests)
|
|
endif()
|