From 68df9aeca80f5b24404bff8e28d47d6af2a288a0 Mon Sep 17 00:00:00 2001 From: Alex James Date: Thu, 28 Nov 2024 13:47:41 -0600 Subject: [PATCH] meson: Support system-provided gtest/gmock Meson currently builds gtest from a subproject before running the tests. Update tests/meson.build to support using a system-provided version of gtest and gmock when they are present. --- tests/meson.build | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/meson.build b/tests/meson.build index 32eaa677bc..c3f11d9929 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -3,9 +3,13 @@ all_test_dep_libs = [] all_test_sources = [] -gtest_proj = subproject('gtest') -gtest_dep = gtest_proj.get_variable('gtest_dep') -gmock_dep = gtest_proj.get_variable('gmock_dep') +gtest_dep = dependency('gtest', main: true, required: false) +gmock_dep = dependency('gmock', required: false) +if not gtest_dep.found() or not gmock_dep.found() + gtest_proj = subproject('gtest') + gtest_dep = gtest_proj.get_variable('gtest_dep') + gmock_dep = gtest_proj.get_variable('gmock_dep') +endif all_test_deps += [