Skip to content

Commit

Permalink
Add a CMake option to disable shared libs
Browse files Browse the repository at this point in the history
This option is useful to support platforms that do not support
dynamic libraries and `dlopen`.
  • Loading branch information
tobim committed Oct 12, 2024
1 parent 6445819 commit 7d4291f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ option(WITH_ASYNC_EXPORT_PREVIEW "Whether to enable async export" OFF)
option(WITH_METRICS_EXEMPLAR_PREVIEW
"Whether to enable exemplar within metrics" OFF)

option(OPENTELEMETRY_STATIC_ONLY
"Whether to build test libraries that are always linked as shared libs"
OFF)

#
# Verify options dependencies
#
Expand Down
4 changes: 4 additions & 0 deletions api/test/singleton/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

if(OPENTELEMETRY_STATIC_ONLY)
return()
endif()

include(GoogleTest)

# Header only singletons are not available in windows yet.
Expand Down
4 changes: 4 additions & 0 deletions examples/plugin/plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

if(OPENTELEMETRY_STATIC_ONLY)
return()
endif()

add_library(example_plugin SHARED tracer.cc factory_impl.cc)
target_link_libraries(example_plugin opentelemetry_api)

0 comments on commit 7d4291f

Please sign in to comment.