views:

1386

answers:

1

I'm having a problem getting XCode to deal with a particular file structure that I am using or that I wish to use.

I have a set of files in the following form...


Library
   Headers
      Library
         Package1
            Header1.h
            Header2.h
            HeaderN.h 
         Package2
            Header1.h
            Header2.h
            HeaderN.h 
         PackageN
            Header1.h
            Header2.h
            HeaderN.h 
   Source
      Package1
         Source1.m
         Source2.m
         SourceN.m 
      Package2
         Source1.m
         Source2.m
         SourceN.m 
      Package3
         Source1.m
         Source2.m
         SourceN.m 

The include model I want for code outside of this library is...

#import "Library/Package/Header.h"

I want to point XCode at Library/Headers but not at the internal folders. When I add this tree to the project XCode seems to make implicit include paths to every node in the tree.

Client code within the project but outside this tree can do this...

#import "Header.h"

instead of...

#import "Library/Package/Header.h"

I can't seem to find a way to dissallow the non-qualified form.

Any help would be appreciated.

Thanks, -Roman

+1  A: 

If you include the headers in files in the project then XCode will always find them without path qualification, as you've discovered. The best solution is to remove the headers from the project and specify "Library/Headers" as a header search path in your project settings. The headers won't show in your project, but they also won't be implicitly found by XCode while compiling, either; client code will have to specify the full path off of "Library/Headers" to get to the header file they want.

fbrereto
I see. Thats a shame when I'm authoring the library and the app at the same time. Guess I could always break it out into its own project. I tried making a library target within the same project but that doesn't change the implicit paths either.
I found that there is a way to have the headers in your project for ease of editing but not have them found by the project. Just import the headers as folder references (blue rather than yellow in xcode).
+1 useful; thanks!
fbrereto