Skip to content

Commit

Permalink
Fix GMock linkage error on Windows (#633)
Browse files Browse the repository at this point in the history
Fix GMock linkage error on Windows.
  • Loading branch information
maxgolov authored Mar 27, 2021
1 parent 4751ae5 commit 9fa6bd5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion exporters/otlp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ if(BUILD_TESTING)
TARGET recordable_test
TEST_PREFIX exporter.otlp.
TEST_LIST recordable_test)
find_library(GMOCK_LIB gmock PATH_SUFFIXES lib)
if(MSVC)
add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1)
endif()
if(MSVC AND CMAKE_BUILD_TYPE STREQUAL "Debug")
find_library(GMOCK_LIB gmockd PATH_SUFFIXES lib)
else()
find_library(GMOCK_LIB gmock PATH_SUFFIXES lib)
endif()
if(GMOCK_LIB)
add_executable(otlp_exporter_test test/otlp_exporter_test.cc)
target_link_libraries(
Expand Down

0 comments on commit 9fa6bd5

Please sign in to comment.