Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create versioned shared libraries #275

Merged
merged 1 commit into from
Apr 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions exporters/geneva/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
project(opentelemetry-geneva-metrics)
set(MAIN_PROJECT ON)
endif()
option(OTELCPP_VERSIONED_LIBS "Whether to generate the versioned shared libs"
OFF)
if(OTELCPP_VERSIONED_LIBS AND NOT BUILD_SHARED_LIBS)
message(FATAL_ERROR "OTELCPP_VERSIONED_LIBS=ON requires BUILD_SHARED_LIBS=ON")
endif()


if(NOT WIN32)
find_package(CURL REQUIRED)
Expand All @@ -21,6 +27,17 @@ endif()

include_directories(include)

set(OTEL_GENEVA_EXPORTER_VERSION 1.0.0)
set(OTEL_GENEVA_EXPORTER_MAJOR_VERSION 1)

function(set_target_version target_name)
if(OTELCPP_VERSIONED_LIBS)
set_target_properties(
${target_name} PROPERTIES VERSION ${OTEL_GENEVA_EXPORTER_VERSION}
SOVERSION ${OTEL_GENEVA_EXPORTER_MAJOR_VERSION})
endif()
endfunction()

# create geneva metrics exporter
if(WIN32)
add_library(
Expand All @@ -44,6 +61,8 @@ endif()

set_target_properties(opentelemetry_exporter_geneva_metrics
PROPERTIES EXPORT_NAME metrics)
set_target_version(opentelemetry_exporter_geneva_metrics)

if(BUILD_TESTING)
if(EXISTS ${CMAKE_BINARY_DIR}/lib/libgtest.a)
# Prefer GTest from build tree. GTest is not always working with
Expand Down