I will prefix this question with my usual “I may be missing
something absolutely obvious here”.
If I add a library file or framework to an Xcode project
using the normal “Add existing” methods then an entry is created
which appears to hold knowledge of how to create the absolute path to the file.
This can be seen by doing a “Get Info” on the entry. If I then add
this entry to a target, either via the targets pane of the entries “Get
Info” or via drag and drop, it gets added to the “Link Binary with
libraries” build phase of the target. However it appears that only the
leaf portion of the path is ever used, this can be verified by looking at the
build log. If the file is in a non standard directory you have to add that
directory to “Library Search Paths” or “Framework Search
Paths” in order for the linker to find the file.
This is somewhat non intuitive but potentially very useful
behaviour, but it can lead the unwary into deep waters, especially if a library
with the same leaf name exists elsewhere on the full list of search paths.
However my real question is: can this behaviour be relied
upon? i.e. Is it always the case, or are there cases where an absolute path if
used? If so, how is the behaviour controlled?
RTFM pointers gratefully accepted J.
Thanks,
Roger