waf: ignore -Wundef for gtest

The gtest header uses lots of undefined macros, showing lots of warnings
if we enable -Wundef. Ideally we could use a #pragma to ignore the
warning only from the correct header, but this currently doesn't work
with g++ - see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

So for now we disable the warning completely when compiling gtest or any
test that uses its header.

Thanks Gustavo Sousa
This commit is contained in:
Lucas De Marchi 2016-02-18 12:45:21 -02:00
parent 4ba769d4a3
commit f0277cecb4
2 changed files with 3 additions and 0 deletions

View File

@ -185,6 +185,7 @@ def ap_find_tests(bld, use=[]):
program_name=f.change_ext('').name,
program_group='tests',
use_legacy_defines=False,
cxxflags=['-Wno-undef'],
)
@conf

View File

@ -5,6 +5,7 @@
gtest is a Waf tool for test builds in Ardupilot
"""
from waflib import Utils
from waflib.Configure import conf
def configure(cfg):
@ -25,6 +26,7 @@ def configure(cfg):
@conf
def libgtest(bld, **kw):
kw['cxxflags'] = Utils.to_list(kw.get('cxxflags', [])) + ['-Wno-undef']
kw.update(
source='modules/gtest/src/gtest-all.cc',
target='gtest/gtest',