[PATCH] D126219: [gn build] Use -I= instead of explicitly handling sysroot

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 09:29:39 PDT 2022


thakis created this revision.
thakis added a reviewer: aeubanks.
Herald added a project: All.
thakis requested review of this revision.
Herald added a project: LLVM.

See e.g. de87e5f87565b787 for some more information on -I=.

No intended behavior change.


https://reviews.llvm.org/D126219

Files:
  llvm/utils/gn/build/libs/xml/BUILD.gn


Index: llvm/utils/gn/build/libs/xml/BUILD.gn
===================================================================
--- llvm/utils/gn/build/libs/xml/BUILD.gn
+++ llvm/utils/gn/build/libs/xml/BUILD.gn
@@ -1,15 +1,14 @@
 import("//llvm/utils/gn/build/libs/xml/enable.gni")
-import("//llvm/utils/gn/build/mac_sdk.gni")
-import("//llvm/utils/gn/build/sysroot.gni")
 
 config("xml_config") {
   visibility = [ ":xml" ]
   libs = [ "xml2" ]
-  if (host_os == "mac") {
-    include_dirs = [ "$mac_sdk_path/usr/include/libxml2" ]
-  } else {
-    include_dirs = [ "$sysroot/usr/include/libxml2" ]
-  }
+
+  # The leading '=' means that this absolute path is relative to the sysroot,
+  # if one is being used.
+  # (Can't use `include_dirs` because GN doesn't know about leading `=`
+  # and treats `=/...` as a relative path.)
+  cflags = [ "-I=/usr/include/libxml2" ]
 }
 
 group("xml") {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126219.431403.patch
Type: text/x-patch
Size: 880 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220523/6ab3020d/attachment.bin>


More information about the llvm-commits mailing list