Commit a8c8396f authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

pkg_config: Fixes when use_sysroot=false

This CL introduces 2 changes to the behavior of pkg_config when
use_sysroot=false:

1. The path is not made relative to the build directory.  This fixes the case
where your src directory may be mounted at different locations.

2. -I is used instead of -isystem.  When -isystem is used, dep files do not
reference the system header files.  This is OK when using the sysroot because
the CR_SYSROOT_HASH macro contains the sysroot revision so any source files will
be rebuilt when the sysroot updates.

R=dpranke

Change-Id: Ia3d7df51880205fee888923283b76078ccb3112f
Reviewed-on: https://chromium-review.googlesource.com/1159689Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580030}
parent 0ea2267a
...@@ -103,11 +103,15 @@ template("pkg_config") { ...@@ -103,11 +103,15 @@ template("pkg_config") {
pkgresult = exec_script(pkg_config_script, args, "value") pkgresult = exec_script(pkg_config_script, args, "value")
cflags = pkgresult[1] cflags = pkgresult[1]
# We want the system include paths to use -isystem instead of -I to suppress
# warnings in those headers.
foreach(include, pkgresult[0]) { foreach(include, pkgresult[0]) {
if (use_sysroot) {
# We want the system include paths to use -isystem instead of -I to
# suppress warnings in those headers.
include_relativized = rebase_path(include, root_build_dir) include_relativized = rebase_path(include, root_build_dir)
cflags += [ "-isystem$include_relativized" ] cflags += [ "-isystem$include_relativized" ]
} else {
cflags += [ "-I$include" ]
}
} }
if (!defined(invoker.ignore_libs) || !invoker.ignore_libs) { if (!defined(invoker.ignore_libs) || !invoker.ignore_libs) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment