Skip to content

Commit

Permalink
cmake: Build gtest and benchmark as shared lib with MSVC
Browse files Browse the repository at this point in the history
should fix `gmock.lib(gtest-all.obj) : error LNK2005`
  • Loading branch information
Mizux committed Jan 31, 2025
1 parent ee6c8cc commit 2eb919b
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions cmake/dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,7 @@ if(BUILD_googletest)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
set(INSTALL_GTEST OFF)
set(GTEST_HAS_ABSL ON)
if(WIN32)
set(BUILD_SHARED_LIBS OFF)
endif()
FetchContent_MakeAvailable(googletest)
if(WIN32)
set(BUILD_SHARED_LIBS ON)
endif()

list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()
Expand All @@ -438,13 +431,7 @@ if(BUILD_benchmark)
set(BENCHMARK_ENABLE_TESTING OFF)
set(BENCHMARK_ENABLE_WERROR OFF)
set(BENCHMARK_ENABLE_INSTALL OFF)
if(WIN32)
set(BUILD_SHARED_LIBS OFF)
endif()
FetchContent_MakeAvailable(benchmark)
if(WIN32)
set(BUILD_SHARED_LIBS ON)
endif()
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "fetched")
endif()

0 comments on commit 2eb919b

Please sign in to comment.