Skip to content

Commit 7d4291f

Browse files
committed
Add a CMake option to disable shared libs
This option is useful to support platforms that do not support dynamic libraries and `dlopen`.
1 parent 6445819 commit 7d4291f

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,10 @@ option(WITH_ASYNC_EXPORT_PREVIEW "Whether to enable async export" OFF)
287287
option(WITH_METRICS_EXEMPLAR_PREVIEW
288288
"Whether to enable exemplar within metrics" OFF)
289289

290+
option(OPENTELEMETRY_STATIC_ONLY
291+
"Whether to build test libraries that are always linked as shared libs"
292+
OFF)
293+
290294
#
291295
# Verify options dependencies
292296
#

api/test/singleton/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Copyright The OpenTelemetry Authors
22
# SPDX-License-Identifier: Apache-2.0
33

4+
if(OPENTELEMETRY_STATIC_ONLY)
5+
return()
6+
endif()
7+
48
include(GoogleTest)
59

610
# Header only singletons are not available in windows yet.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Copyright The OpenTelemetry Authors
22
# SPDX-License-Identifier: Apache-2.0
33

4+
if(OPENTELEMETRY_STATIC_ONLY)
5+
return()
6+
endif()
7+
48
add_library(example_plugin SHARED tracer.cc factory_impl.cc)
59
target_link_libraries(example_plugin opentelemetry_api)

0 commit comments

Comments
 (0)