CMake: Use CMAKE_SOURCE_DIR in GTEST_SRC_DIR

This makes the use of this location work the same even if building
in a separate build directory; the "if (EXISTS ${GTEST_SRC_DIR}/..."
check would otherwise fail when building in a different directory.

Change-Id: I56496852972b479b9a4c3cb183c14205b0d1270c
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/5444429
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
Martin Storsjö 2024-04-11 11:08:07 +03:00 committed by Frank Barchard
parent 5fb6c8cbe3
commit d43a3bb2df

View File

@ -148,7 +148,7 @@ if(UNIT_TEST)
if(GTEST_LIBRARY STREQUAL "GTEST_LIBRARY-NOTFOUND")
set(GTEST_SRC_DIR_DEFAULT /usr/src/gtest)
if (CMAKE_CROSSCOMPILING)
set(GTEST_SRC_DIR_DEFAULT third_party/googletest/src/googletest)
set(GTEST_SRC_DIR_DEFAULT ${CMAKE_SOURCE_DIR}/third_party/googletest/src/googletest)
endif()
set(GTEST_SRC_DIR ${GTEST_SRC_DIR_DEFAULT} CACHE STRING "Location of gtest sources")
if(EXISTS ${GTEST_SRC_DIR}/src/gtest-all.cc)