1

I added my /usr/local/bin and /opt/homebrew/include to my CPATH variable. This way the clang compiler recognizes libraries residing in these paths when invoked from command line. However, when I am to develop something in Xcode, Xcode (12.5.1) doesn't recognize these paths unless explicitly added to Xcode project settings. As you may have experienced, doing so is really troublesome.

I want these paths added to CPATH to be globally available to all C/C++ projects in Xcode in Big Sur (11.6) M1 Macs without having to explicitly add them in each project settings.

Is it possible?

nohillside
  • 100,768
nmd_07
  • 203
  • This may be what you are looking for: https://apple.stackexchange.com/q/106355/30895. – Martin R Sep 19 '21 at 10:07
  • 1
    @MartinR Thanks but I need an up-to-date explanation. – nmd_07 Sep 19 '21 at 11:00
  • 1
    Really you don't want this you need to control by project. Also your first sentence is confusing - libraries are in neither of those directories. header files will be in the latter. – mmmmmm Sep 19 '21 at 12:04
  • My general experience in C programmimg is that you want all your environment information in your build scripts and no in your environment as you can't show whet was used to build the code. (Given how Apple have removed the easy setting of environment variables seems to be their choice as well) – mmmmmm Sep 19 '21 at 12:25
  • @mmmmmm Can you show an example of how a build script for a C/C++ Xcode project should be? Never done it before. – nmd_07 Sep 19 '21 at 12:58
  • For Xcode it is the Xcode project . I meant Xcode or Eclipse or Visual Studio project or Makefile or any other build tool. You then have all the build information under version control and also can move the project between machines etc – mmmmmm Sep 19 '21 at 13:07
  • The best way might be to produce Xcode project templates which have the paths in them. Then new projects will have the paths in – mmmmmm Sep 19 '21 at 13:11

0 Answers0