Header search paths for subproject in XCode

I added a subproject (a library) to my project.

In order to be able to import the header files of the subproject, I'm adding the absolute path to the subproject directory (recursive) to the "Header Search Paths" of my main project. Is there anyway to configure XCode to automatically/ dynamically recognise the path to my subproject directory?

I feel that what I'm doing right now is very manual and prone to human errors. Also, in case I moved my subproject, I will not be able to import its header files anymore.

Note that I don't want to put the subproject directory inside the same directory with the main project as it will be reused for many different projects.

The reason why I expected this functionality of XCode are:

  • XCode allows me to drag and drop my library project into the main one, which is an intuitive and dynamic way of including library. It should not, therefore, require me to manually put in the path to the main project's build settings.
  • When we drag and drop our files and directories into an XCode project, it seems to handle the XCode's references and the filesystem paths smoothly. I don't understand how the logic differs for header search paths for subprojects?

  • You can use a relative directory, as opposed to an absolute directory, by using $(PROJECT_DIR) , which is one of Xcode's many variables.

    Assuming the sub-project is in a sibling directory to the app project (a system I use myself), then set Header Search Path to (something like):

    $(PROJECT_DIR)/../libproject/include
    

    This will allow the project to exist anywhere in the filesystem, provided the project directories maintain the same relative path to each other.

    链接地址: http://www.djcxy.com/p/42644.html

    上一篇: 找不到用户标题路径

    下一篇: XCode中子项目的标题搜索路径