1

This is related to preserve include path in xcode, but is the complimentary problem.

We are organizing our code on disk into logical components with folders like:

ComponentA/HeaderA.h
ComponentB/HeaderB.h

and require that team members import them like

#import "ComponentA/HeaderA.h"
#import "ComponentB/HeaderB.h"

We use the USER_HEADER_SEARCH_PATHS pointing at the directory above ComponentA/B to enable the compiler to find these, it works fine.

However, these headers are included in the Xcode project, so if someone accidentally uses

#import "HeaderA.h"
#import "HeaderB.h"

then Xcode will still find the header, but we want it to produce a compiler error. Is there a way to get Xcode to stop finding these headers unless the hierarchical name is used?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Adrian
  • 1,842
  • 13
  • 25
  • Does this answer your question? [controlling which project header file Xcode will include](https://stackoverflow.com/questions/2596695/controlling-which-project-header-file-xcode-will-include) – David Ansermot Oct 26 '22 at 15:59

1 Answers1

0

It turns out that this has been asked before in controlling which project header file Xcode will include

The key undocumented setting is USE_HEADERMAP=NO, which stops Xcode from automatically finding any header file that has been added to the project.

Community
  • 1
  • 1
Adrian
  • 1,842
  • 13
  • 25