test/gtest: Ignore pedantic compiler warnings
Change-Id: I4cea868776f10575e46e1b324f2f80aebcf0ed35
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/meson.build b/test/meson.build
index 11eccf5..a63240f 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -1,7 +1,12 @@
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('googletest', required: false)
+ gtest_proj = import('cmake').subproject(
+ 'googletest',
+ cmake_options: [
+ '-DCMAKE_CXX_FLAGS=-Wno-pedantic',
+ ],
+ required: false)
if gtest_proj.found()
gtest = declare_dependency(
dependencies: [
@@ -22,12 +27,14 @@
'util/string',
]
-foreach t : gtests
- test(t, executable(t.underscorify(), t + '.cpp',
- build_by_default: false,
- implicit_include_directories: false,
- dependencies: [stdplus, gtest, gmock]))
-endforeach
+if gtest.found() and gmock.found()
+ foreach t : gtests
+ test(t, executable(t.underscorify(), t + '.cpp',
+ build_by_default: false,
+ implicit_include_directories: false,
+ dependencies: [stdplus, gtest, gmock]))
+ endforeach
+endif
# catch2 might not have a pkg-config. It is header only so just make
# sure we can access the needed symbols from the header.