From 1434f3b48bffc1c7d1c7b5accdc72affd118d50e Mon Sep 17 00:00:00 2001 From: Mats Taraldsvik Date: Wed, 27 Dec 2023 22:29:46 +0100 Subject: [PATCH] Fix common_foo_library when building with OPENTELEMETRY_BUILD_DLL --- examples/common/foo_library/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/common/foo_library/CMakeLists.txt b/examples/common/foo_library/CMakeLists.txt index 1ef87df1e1..9e42004939 100644 --- a/examples/common/foo_library/CMakeLists.txt +++ b/examples/common/foo_library/CMakeLists.txt @@ -8,5 +8,9 @@ endif() add_library(common_foo_library foo_library.h foo_library.cc) set_target_version(common_foo_library) -target_link_libraries(common_foo_library PUBLIC ${CMAKE_THREAD_LIBS_INIT} +if(DEFINED OPENTELEMETRY_BUILD_DLL) + target_link_libraries(common_foo_library opentelemetry_cpp) +else() + target_link_libraries(common_foo_library PUBLIC ${CMAKE_THREAD_LIBS_INIT} opentelemetry_api) +endif()