We have two options.
Look at Preferences-> Locations β "Source Trees" in Xcode Preferences. The path added here will be a system level path and is available for inclusion for all projects.
Set the HEADER_SEARCH_PATHS parameter in the build settings in the project information. I added "${SRCROOT}" here without recursion. This option is suitable for most projects.
About the second option:
Xcode uses Clang, which has a GCC-compatible command. GCC has the -Idir option , which adds search paths to the system header. And this parameter is available through HEADER_SEARCH_PATHS in the build configuration of the Xcode project.
However, the path string added to this parameter should not contain whitespace, because the option will be passed to the shell command as is.
But some OS X users (like me) can put their projects on the path, including spaces that need to be escaped . You can avoid it like /Users/my/work/a\ project\ with\ space if you enter it manually. You can also escape them with quotes to use an environment variable such as "${SRCROOT}" .
Or just use it . to indicate the current directory. I saw this trick in the Webkit source code, but I'm not sure that the current directory will be installed in the project directory when it is created.
${SRCROOT} - A predefined value by Xcode. This means the source directory. You can find more values ββin the Reference Document .
PS. You really don't need to use curly braces {} . I get the same result with $SRCROOT . If you know the difference, let me know.
Eonil Aug 6 2018-10-10T00: 00Z
source share