2019-12-17 23:20:22 +03:00
|
|
|
add_library(opentelemetry_api INTERFACE)
|
|
|
|
target_include_directories(
|
2020-12-29 21:33:52 +03:00
|
|
|
opentelemetry_api
|
|
|
|
INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
|
|
|
|
"$<INSTALL_INTERFACE:include>")
|
|
|
|
|
|
|
|
set_target_properties(opentelemetry_api PROPERTIES EXPORT_NAME api)
|
|
|
|
|
|
|
|
install(
|
|
|
|
TARGETS opentelemetry_api
|
|
|
|
EXPORT "${PROJECT_NAME}-target"
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
2019-12-17 23:20:22 +03:00
|
|
|
|
2021-05-29 07:34:52 +03:00
|
|
|
set(LOGS_EXCLUDE_PATTERN "")
|
|
|
|
if(NOT WITH_LOGS_PREVIEW)
|
|
|
|
set(LOGS_EXCLUDE_PATTERN "logs")
|
|
|
|
endif()
|
|
|
|
|
2021-05-28 11:57:15 +03:00
|
|
|
set(METRICS_EXCLUDE_PATTERN "")
|
|
|
|
if(NOT WITH_METRICS_PREVIEW)
|
|
|
|
set(METRICS_EXCLUDE_PATTERN "metrics")
|
|
|
|
endif()
|
|
|
|
|
2019-12-17 23:20:22 +03:00
|
|
|
install(
|
|
|
|
DIRECTORY include/opentelemetry
|
|
|
|
DESTINATION include
|
|
|
|
FILES_MATCHING
|
2021-05-28 11:57:15 +03:00
|
|
|
PATTERN "*.h"
|
|
|
|
PATTERN "${METRICS_EXCLUDE_PATTERN}" EXCLUDE)
|
2019-12-17 23:20:22 +03:00
|
|
|
|
2021-05-29 07:34:52 +03:00
|
|
|
install(
|
|
|
|
DIRECTORY include/opentelemetry
|
|
|
|
DESTINATION include
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.h"
|
|
|
|
PATTERN "${LOGS_EXCLUDE_PATTERN}" EXCLUDE)
|
|
|
|
|
2019-12-17 23:20:22 +03:00
|
|
|
if(BUILD_TESTING)
|
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|
2020-12-22 08:57:48 +03:00
|
|
|
|
2021-06-09 06:42:44 +03:00
|
|
|
if(WITH_ABSEIL)
|
2022-04-07 09:06:59 +03:00
|
|
|
|
|
|
|
find_package(absl CONFIG REQUIRED)
|
|
|
|
|
2021-06-09 06:42:44 +03:00
|
|
|
target_compile_definitions(opentelemetry_api INTERFACE HAVE_ABSEIL)
|
2022-04-07 09:06:59 +03:00
|
|
|
target_link_libraries(
|
|
|
|
opentelemetry_api INTERFACE absl::bad_variant_access absl::any absl::base
|
|
|
|
absl::bits absl::city)
|
|
|
|
|
2021-06-09 06:42:44 +03:00
|
|
|
endif()
|
|
|
|
|
2020-12-22 08:57:48 +03:00
|
|
|
if(WITH_STL)
|
|
|
|
message("Building with standard library types...")
|
2022-01-25 06:14:20 +03:00
|
|
|
target_compile_definitions(opentelemetry_api INTERFACE HAVE_CPP_STDLIB)
|
2020-12-22 08:57:48 +03:00
|
|
|
else()
|
|
|
|
message("Building with nostd types...")
|
|
|
|
endif()
|
2021-06-12 18:59:37 +03:00
|
|
|
|
2022-04-07 09:06:59 +03:00
|
|
|
if(WITH_GSL)
|
|
|
|
target_compile_definitions(opentelemetry_api INTERFACE HAVE_GSL)
|
|
|
|
|
|
|
|
# Guidelines Support Library path. Used if we are not on not get C++20.
|
|
|
|
#
|
|
|
|
find_package(Microsoft.GSL QUIET)
|
|
|
|
if(TARGET Microsoft.GSL::GSL)
|
|
|
|
target_link_libraries(opentelemetry_api INTERFACE Microsoft.GSL::GSL)
|
|
|
|
else()
|
|
|
|
set(GSL_DIR third_party/ms-gsl)
|
|
|
|
target_include_directories(
|
|
|
|
opentelemetry_api INTERFACE "$<BUILD_INTERFACE:${GSL_DIR}/include>")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2021-10-23 19:40:30 +03:00
|
|
|
if(WITH_METRICS_PREVIEW)
|
|
|
|
target_compile_definitions(opentelemetry_api INTERFACE ENABLE_METRICS_PREVIEW)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_LOGS_PREVIEW)
|
|
|
|
target_compile_definitions(opentelemetry_api INTERFACE ENABLE_LOGS_PREVIEW)
|
|
|
|
endif()
|
|
|
|
|
2022-04-07 09:06:59 +03:00
|
|
|
if(WITH_NO_GENENV)
|
|
|
|
target_compile_definitions(opentelemetry_api INTERFACE NO_GETENV)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
target_compile_definitions(opentelemetry_api INTERFACE NOMINMAX)
|
|
|
|
if(WITH_ETW)
|
|
|
|
target_compile_definitions(opentelemetry_api INTERFACE HAVE_MSGPACK)
|
|
|
|
endif()
|
2021-06-12 18:59:37 +03:00
|
|
|
endif()
|