Skip to content

Commit 926f681

Browse files
Merge pull request #4466 from danfabo:fix-fetch-content-uses-gtest
PiperOrigin-RevId: 612560830 Change-Id: Ib639603d34258909cf0e0d6fceb297dd8c983d54
2 parents e4fdb87 + f5448b3 commit 926f681

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

googlemock/CMakeLists.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ endif()
6565
config_compiler_and_linker() # from ${gtest_dir}/cmake/internal_utils.cmake
6666

6767
# Adds Google Mock's and Google Test's header directories to the search path.
68+
# Get Google Test's include dirs from the target, gtest_SOURCE_DIR is broken
69+
# when using fetch-content with the name "GTest".
70+
get_target_property(gtest_include_dirs gtest INCLUDE_DIRECTORIES)
6871
set(gmock_build_include_dirs
6972
"${gmock_SOURCE_DIR}/include"
7073
"${gmock_SOURCE_DIR}"
71-
"${gtest_SOURCE_DIR}/include"
72-
# This directory is needed to build directly from Google Test sources.
73-
"${gtest_SOURCE_DIR}")
74+
"${gtest_include_dirs}")
7475
include_directories(${gmock_build_include_dirs})
7576

7677
########################################################################

0 commit comments

Comments
 (0)