meson: Provide "gmock" for local build

Currently local meson build fails with the error:
"""
test/meson.build:1:8: ERROR: Dependency "gmock" not found, tried
pkgconfig and system
"""
Provide "gmock/gtest" for local build to fix the issue.

Tested:
"meson setup build" no longer fails with the "gmock not found" error.

Change-Id: Ia5987e9355e76ce69fa5258d19f097be10a9d5f9
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
diff --git a/test/meson.build b/test/meson.build
index c725739..f78d8df 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -1,13 +1,31 @@
-gmock = dependency('gmock', disabler: true, required: build_tests)
-gtest = dependency('gtest', main: true, disabler: true, required: build_tests)
+gmock_dep = dependency('gmock', disabler: true, required: build_tests)
+gtest_dep = dependency('gtest', main: true, disabler: true, required: build_tests)
+if not gtest_dep.found() or not gmock_dep.found()
+    gtest_proj = import('cmake').subproject('googletest', required: false)
+    if gtest_proj.found()
+        gtest_dep = declare_dependency(
+            dependencies: [
+                dependency('threads'),
+                gtest_proj.dependency('gtest'),
+                gtest_proj.dependency('gtest_main'),
+            ]
+        )
+        gmock_dep = gtest_proj.dependency('gmock')
+    else
+        assert(
+            not get_option('tests').enabled(),
+            'Googletest is required if tests are enabled'
+        )
+    endif
+endif
 
 test(
     'utest',
     executable(
         'utest', 'utest.cpp',
         dependencies: [
-            gmock,
-            gtest,
+            gmock_dep,
+            gtest_dep,
             libevdev,
             sdbusplus,
         ],