Skip to content

Commit

Permalink
Unset GMOCK_LIB before find_library to force lookup (#726)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomsonTan authored May 5, 2021
1 parent 2d2aa71 commit 556061a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions exporters/otlp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ if(BUILD_TESTING)
if(MSVC)
add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1)
endif()
if(GMOCK_LIB)
# unset GMOCK_LIB to force find_library to redo the lookup, as the cached
# entry could cause linking to incorrect flavor of gmock and leading to
# runtime error.
unset(GMOCK_LIB CACHE)
endif()
if(MSVC AND CMAKE_BUILD_TYPE STREQUAL "Debug")
find_library(GMOCK_LIB gmockd PATH_SUFFIXES lib)
else()
Expand Down

0 comments on commit 556061a

Please sign in to comment.