[PATCH] D69221: [clang][darwin] Fix search path logic for C_INCLUDE_DIRS

Marco Hinz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 27 08:27:09 PST 2019


mhinz added a comment.

I applied the fix to all toolchains now, but I'm unsure how to write a test for it. Neither could I find tests for similar options like `-DDEFAULT_SYSROOT`.

My use case: I want to build a clang that has the same search path as the clang shipped with macOS.

  $ /usr/bin/clang -E -xc -v /dev/null
  [snip]
  #include <...> search starts here:
   /usr/local/include
   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.0/include
   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
  End of search list.
  [snip]

For this, I need to pass this to cmake:

  -DC_INCLUDE_DIRS="/usr/local/include:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include:/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
  -DDEFAULT_SYSROOT="$(xcrun --show-sdk-path)"


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69221/new/

https://reviews.llvm.org/D69221





More information about the cfe-commits mailing list