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()