From f2e56b6c53c2e55f0a3786d9ef1828a0bb3af60d Mon Sep 17 00:00:00 2001 From: Guilherme Janczak Date: Thu, 19 Dec 2024 17:41:43 +0000 Subject: [PATCH] use system gtest if available Package maintainers won't need to patch Aegisub to use the system version. This also helps Aegisub compile on platforms where the unmodified gtest source doesn't compile but a package is available, such as OpenBSD. I've tested the conditional branch where gtest is present in the system on OpenBSD. I can't properly test the branch where it isn't present because the subproject doesn't compile on OpenBSD, but I've checked that it tries to compile the subproject. --- tests/meson.build | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/meson.build b/tests/meson.build index 2dd870dd30..32d0b59a02 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,6 +1,11 @@ -gtest_proj = subproject('gtest') -gtest_dep = gtest_proj.get_variable('gtest_dep') -gmock_dep = gtest_proj.get_variable('gmock_dep') +gtest_dep = dependency('gtest', required : false) +gmock_dep = dependency('gmock', required : false) + +if not (gtest_dep.found() and gmock_dep.found()) + gtest_proj = subproject('gtest') + gtest_dep = gtest_proj.get_variable('gtest_dep') + gmock_dep = gtest_proj.get_variable('gmock_dep') +endif tests_deps = [ gtest_dep,