How to add a global include path for xcode

前端 未结 5 1056
感情败类
感情败类 2020-12-08 21:53

I\'d like to add ~/include to my include path for all projects while using Xcode, something like setting the environment variable CPLUS_INCLUDE_PATH in

5条回答
  •  误落风尘
    2020-12-08 22:42

    Build settings are not environment variables, and environment variables are not build settings. Setting an environment variable will not affect Xcode builds.

    USER_HEADER_SEARCH_PATHS is a build setting, and putting a list of paths into it will achieve what you want. If you set the value in a target's inspector, it will take effect for only that target (and only for the Build Configurations you designate). If you set it in the Project inspector, it will take effect in all targets in the project, unless a target overrides it with its own setting.

    For paths that are specific to your machine, you should probably define a Source Tree in the Xcode Preferences, such as LOCAL_INCLUDE = ~/include . Then define USER_HEADER_SEARCH_PATHS = $(LOCAL_INCLUDE) in the project. This way, other people can open your project and build it by setting their Source Tree to the particular location of the local includes on their machine, without having to change the project file.

提交回复
热议问题