Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two targets, two header files with the same name how to use each header for the right target?

Tags:

xcode

ios

header

Ok, here's what I've tried.

I have the header files in two separate directories IRL. They're named the same, but are in two different locations.

I want to only include the relevant header file for each target. Lets say for ease of explaination that the header file is called "Config.h".

So I have:

${PRODUCT_DIR}/Header1/Config.h

and

${PRODUCT_DIR}/Header2/Config.h

These files appear in the LHS of Xcode as well in two different groups (Header1 and Header2 which point to the IRL folders).

So now all I need to do is to make Xcode choose the right one from the right folder for each target.

Target1

and

Target2

I have tried adding the path to the User Header Search Paths for each target, but its still choosing the wrong one. I've also tried toggling "Always search user paths" which also doesn't seem to have an effect.

So my question is, is this because they're in the Project directory? Or is it because they're in Xcode in the file manager on the LHS, so therefore Xcode is copying them into the build folder?

The strange thing is it seems to be choosing the header files from the folder with the last name alphabetically...

In previous versions of Xcode I'm sure you could choose which headers to copy into the build folder.

Anyway.. does anyone know how I can fix this so that I can have it select the proper header file for the target?

Many thanks.

like image 624
Thomas Clayson Avatar asked Feb 15 '13 18:02

Thomas Clayson


1 Answers

I have 4 targets in 1 proyect and more than 40 headers, the best solution in XCode 8 I think the best solution is change the following tag:

Always Search user Paths

To yes an all was fine for me: enter image description here

like image 72
Jose Pose S Avatar answered Oct 02 '22 15:10

Jose Pose S