diff options
author | Pierre Labatut <plabatut@google.com> | 2023-04-05 06:47:24 +0000 |
---|---|---|
committer | Pierre Labatut <plabatut@google.com> | 2023-04-05 06:54:34 +0000 |
commit | ada3705067724af1472dd80f8bf4a8e777509343 (patch) | |
tree | 2bf3b6657615f58f3e75b453714f8bf2d254eaeb /third-party | |
parent | cf821ae0db16067f0523e769a3a9a8788e772a0a (diff) | |
download | aemu-ada3705067724af1472dd80f8bf4a8e777509343.tar.gz |
Make possible to build from system's gtest.
The current requires the CMake project to be included
in another project that provides the gtest targets.
This change makes possible to locate the dependency
with pkg-config that searches the sysroot.
Bug: b/276425028
Change-Id: I1d09962b82b4bb6dbaea51de3218051a947f2581
Diffstat (limited to 'third-party')
-rw-r--r-- | third-party/CMakeLists.txt | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 55e9233..ac39b15 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -10,5 +10,15 @@ endif() if(ENABLE_VKCEREAL_TESTS AND NOT TARGET gtest) set(INSTALL_GTEST OFF) - message(FATAL_ERROR "googletest is not provided.") + + # If gtest target is not provided, find it on the system. + find_package(PkgConfig REQUIRED) + pkg_search_module(gtest REQUIRED IMPORTED_TARGET GLOBAL gtest>=0.0.0) + add_library(gtest ALIAS PkgConfig::gtest) + + pkg_search_module(gmock REQUIRED IMPORTED_TARGET GLOBAL gmock>=0.0.0) + add_library(gmock ALIAS PkgConfig::gmock) + + pkg_search_module(gmock_main REQUIRED IMPORTED_TARGET GLOBAL gmock_main>=0.0.0) + add_library(gmock_main ALIAS PkgConfig::gmock_main) endif() |