Fix googletest inclusion (#3398)

The googletest root CMakeLists.txt now sets a GOOGLETEST_VERSION variable, which is needed by the subprojects. Use add_subdirectory(external/googletest EXCLUDE_FROM_ALL) to add the root CMakeLists.txt file, which by default builds GMock. We already use EXCLUDE_FROM_ALL, which should shield us from e.g. building their tests, etc. If this causes issues in the future, we can change the googletest CMakeLists.txt file to only mess with compiler settings etc. if it is the root build.
This commit is contained in:
Paul Thomson 2020-06-04 14:15:33 +01:00 committed by GitHub
parent 636f449e15
commit 74130f2d3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,7 +47,7 @@ if (NOT ${SPIRV_SKIP_TESTS})
if (TARGET gmock)
message(STATUS "Google Mock already configured")
else()
set(GMOCK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest/googlemock)
set(GMOCK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest)
if(EXISTS ${GMOCK_DIR})
if(MSVC)
# Our tests use ::testing::Combine. Work around a compiler