waf configure --use-system-clang, prefer bld.env.get_flat('CXX') over clang inferred from llvm-config'

Fixes #237. Credit to @acowley
This commit is contained in:
Fangrui Song 2018-01-07 22:08:43 -08:00
parent acc8f42033
commit a3a89af14f

View File

@ -310,7 +310,13 @@ def build(bld):
output = str(subprocess.check_output(
[bld.env['llvm_config'], '--bindir'],
stderr=subprocess.STDOUT).decode()).strip()
# Use --check-cxx-compiler value if it is "clang".
# See https://github.com/jacobdufault/cquery/issues/237
clang = bld.env.get_flat('CXX')
if 'clang' not in clang:
clang = os.path.join(output, 'clang')
rpath = str(subprocess.check_output(
[bld.env['llvm_config'], '--libdir'],
stderr=subprocess.STDOUT).decode()).strip()