meson: refactor gtest and gmock dependencies
gtest has added first class support for being a meson subproject, so the
gtest/gmock dependencies can be expressed with fewer conditions and more
succinctly. Tested by building and running the unit tests using the
gtest subproject.
Change-Id: I57e43e36b866ebe0229b29f907b2c78acb55b7bc
Signed-off-by: Brad Bishop <bradbish@qti.qualcomm.com>
diff --git a/meson.build b/meson.build
index d8d4c01..7c4336e 100644
--- a/meson.build
+++ b/meson.build
@@ -45,26 +45,13 @@
endif
if get_option('tests').allowed()
- gtest = dependency('gtest', main: true, disabler: true, required: false)
- gmock = dependency('gmock', disabler: true, required: false)
- if not gtest.found() or not gmock.found()
- gtest_proj = import('cmake').subproject('gtest', required: false)
- if gtest_proj.found()
- gtest = declare_dependency(
- dependencies: [
- dependency('threads'),
- gtest_proj.dependency('gtest'),
- gtest_proj.dependency('gtest_main'),
- ],
- )
- gmock = gtest_proj.dependency('gmock')
- else
- assert(
- not get_option('tests').allowed(),
- 'Googletest is required if tests are enabled',
- )
- endif
- endif
+ gtest = dependency(
+ 'gtest_main',
+ main: true,
+ version: '>=1.15.2',
+ required: true,
+ )
+ gmock = dependency('gmock', required: true)
subdir('src/test')
subdir('libmapper/test')
endif