Search code examples
xcodecocoaxcode4osx-snow-leopard

Including a C tool in a Xcode4 project


I have a project which builds two targets, the main app and a tool.

How can I correctly include the tool in the app bundle? I have already navigated to target dependencies and added the tool; however when adding the built executable to the "Copy Bundle Resources" phase, I get a path to the builded product like:

.../.../awieuhfaowasldijfsalkdj/Build/Debug/tool

Is there any way to add the tool to the bundle dynamically, I mean without hardcoding such path? Ideally, I'd like to add the tool in a special folder (say "Tools") inside the "Resources" bundle folder, but I don't even know if that's possible.

Apart from this, is there something else I need to do in order to complete the process of adding it as a resource?


Solution

  • One simple way to avoid the weird path is to specify that the build location should be the one specified by the targets (by default build/Debug or build/Release under the project folder):

    • Open the Xcode preferences
    • Click on the Locations tab
    • Under Build Location, select Place build products in locations specified by targets