summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/libcxx/test/config.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/utils/libcxx/test/config.py b/utils/libcxx/test/config.py
index 397cfdb8f..3373dd100 100644
--- a/utils/libcxx/test/config.py
+++ b/utils/libcxx/test/config.py
@@ -229,21 +229,19 @@ class Configuration(object):
self.cxx.compile_env['CCACHE_CPP2'] = '1'
def _configure_clang_cl(self, clang_path):
+ def _split_env_var(var):
+ return [p.strip() for p in os.environ.get(var, '').split(';') if p.strip()]
+
+ def _prefixed_env_list(var, prefix):
+ from itertools import chain
+ return list(chain.from_iterable((prefix, path) for path in _split_env_var(var)))
+
assert self.cxx_is_clang_cl
flags = []
- compile_flags = []
- link_flags = []
- if 'INCLUDE' in os.environ:
- compile_flags += ['-isystem %s' % p.strip()
- for p in os.environ['INCLUDE'].split(';')
- if p.strip()]
- if 'LIB' in os.environ:
- for p in os.environ['LIB'].split(';'):
- p = p.strip()
- if not p:
- continue
- link_flags += ['-L%s' % p]
- self.add_path(self.exec_env, p)
+ compile_flags = _prefixed_env_list('INCLUDE', '-isystem')
+ link_flags = _prefixed_env_list('LIB', '-L')
+ for path in _list_env_var('LIB'):
+ self.add_path(self.exec_env, path)
return CXXCompiler(clang_path, flags=flags,
compile_flags=compile_flags,
link_flags=link_flags)