Skip to content

Commit 9ac37fd

Browse files
authored
Merge pull request #1035 from htm-community/no_gmock_install
prevent gmock from installing
2 parents 876dace + 3158fab commit 9ac37fd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

external/gtest.cmake

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,25 @@ else()
4040
FetchContent_Declare(
4141
gtest
4242
URL ${dependency_url}
43-
EXCLUDE_FROM_ALL
44-
QUIET
43+
EXCLUDE_FROM_ALL
44+
QUIET
4545
)
4646
endif()
4747

48+
# Make sure that GTest does not try to install itself
49+
set(INSTALL_GTEST OFF)
50+
set(BUILD_GMOCK OFF)
51+
52+
53+
FetchContent_MakeAvailable(gtest)
54+
4855
# For Windows: Prevent overriding the parent project's compiler/linker settings.
4956
# This will force generation of a shared library for gtest.
50-
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
57+
if(MSVC)
58+
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
59+
endif()
60+
61+
set_target_properties(gtest_main PROPERTIES EXCLUDE_FROM_ALL TRUE) # for gtest_main (not used)
5162

52-
FetchContent_MakeAvailable(gtest)
5363

5464
set(gtest_INCLUDE_DIR "${gtest_SOURCE_DIR}/googletest/include")

0 commit comments

Comments
 (0)