summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2012-12-29 08:35:53 (GMT)
committerEvan Martin <martine@danga.com>2012-12-29 08:37:25 (GMT)
commita29686ea9c9300ecc32f21b7ae9d2a0a962bddfc (patch)
tree350e230d8b1c75e849a32348dfa373419c8b4b1c
parentb4e6932b81727bdd1d2266aa220b7c74432c4027 (diff)
downloadNinja-a29686ea9c9300ecc32f21b7ae9d2a0a962bddfc.zip
Ninja-a29686ea9c9300ecc32f21b7ae9d2a0a962bddfc.tar.gz
Ninja-a29686ea9c9300ecc32f21b7ae9d2a0a962bddfc.tar.bz2
fix test build under clang/system gtest
Tests always need GTEST_HAS_RTTI=0 set, but the code was only setting it in the --with-gtest branch. Instead always use the test-specific cflags when compiling test code.
-rwxr-xr-xconfigure.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/configure.py b/configure.py
index e41cf4e..b153f15 100755
--- a/configure.py
+++ b/configure.py
@@ -313,7 +313,7 @@ all_targets += ninja
n.comment('Tests all build into ninja_test executable.')
variables = []
-test_cflags = None
+test_cflags = cflags[:]
test_ldflags = None
test_libs = libs
objs = []
@@ -332,13 +332,17 @@ if options.with_gtest:
os.path.join(path, 'src', 'gtest_main.cc'),
variables=[('cflags', gtest_cflags)])
- test_cflags = cflags + ['-DGTEST_HAS_RTTI=0',
- '-I%s' % os.path.join(path, 'include')]
+ test_cflags.append('-I%s' % os.path.join(path, 'include'))
elif platform == 'windows':
test_libs.extend(['gtest_main.lib', 'gtest.lib'])
else:
+ test_cflags.append('-DGTEST_HAS_RTTI=0')
test_libs.extend(['-lgtest_main', '-lgtest'])
+if test_cflags == cflags:
+ test_cflags = None
+
+n.variable('test_cflags', test_cflags)
for name in ['build_log_test',
'build_test',
'clean_test',
@@ -352,7 +356,7 @@ for name in ['build_log_test',
'subprocess_test',
'test',
'util_test']:
- objs += cxx(name, variables=[('cflags', test_cflags)])
+ objs += cxx(name, variables=[('cflags', '$test_cflags')])
if platform in ('windows', 'mingw'):
for name in ['includes_normalize_test', 'msvc_helper_test']:
objs += cxx(name, variables=[('cflags', test_cflags)])