Skip to content

Commit

Permalink
C++: Adds clang resource-dir to include paths to be searched
Browse files Browse the repository at this point in the history
Fixes #10510

RELNOTES:none
PiperOrigin-RevId: 297089846
  • Loading branch information
oquenchil authored and copybara-github committed Feb 25, 2020
1 parent ff4b3b4 commit f32b0fd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tools/cpp/unix_cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,19 @@ def get_escaped_cxx_inc_directories(repository_ctx, cc, lang_flag, additional_fl
else:
inc_dirs = result.stderr[index1 + 1:index2].strip()

return [
inc_directories = [
_prepare_include_path(repository_ctx, _cxx_inc_convert(p))
for p in inc_dirs.split("\n")
]

if _is_compiler_option_supported(repository_ctx, cc, "-print-resource-dir"):
resource_dir = repository_ctx.execute(
[cc, "-print-resource-dir"],
).stdout.strip() + "/share"
inc_directories.append(_prepare_include_path(repository_ctx, resource_dir))

return inc_directories

def _is_compiler_option_supported(repository_ctx, cc, option):
"""Checks that `option` is supported by the C compiler. Doesn't %-escape the option."""
result = repository_ctx.execute([
Expand Down

0 comments on commit f32b0fd

Please sign in to comment.