Dmytro
Dmytro

Reputation: 1918

"$(SRCROOT)" recursive in XCode Library Search Path

Is it a bad or a good idea to set XCode Library Search Path to "$(SRCROOT)" recursive instead of few concert paths? Why?

Upvotes: 3

Views: 659

Answers (1)

Ihor Zabrotsky
Ihor Zabrotsky

Reputation: 13

Specifying the path (e.g., */Users/username/MyProject/Frameworks*) will work only if you are sure that it will stay the same no matter what. But if you change the location of your dependency, you'll have to manually update the path each time. It can happen if you e. g., want to build a project on another machine (build machine, teammate's machine, etc.)—most probably the dependency will have another path.

In order to have a dynamic path relative to the target's path, we use SRCROOT. As stated in XCode Help:

SRCROOT
Identifies the directory containing the target’s source files.

This means that by placing the dependency relative to the target's path (e. g., *$(SRCROOT)/Frameworks*), we won't need to update the path all the time.

Responding directly to your question: I'd say that if the dependency's path is relative to the target's then it's beneficial to have such dynamic path identification.

As for recursive: This just means that subfolders will be checked recursively for the path you specified; you can actually set recursive or non-recursive for any path.

Upvotes: 1

Related Questions