• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can you use Build Configurations to link with different libraries?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can you use Build Configurations to link with different libraries?


  • Subject: Re: Can you use Build Configurations to link with different libraries?
  • From: Mark Bessey <email@hidden>
  • Date: Tue, 19 Jul 2005 13:41:24 -0700

On Jul 19, 2005, at 10:56 AM, Dave Thorup wrote:

Build Configurations seem to work well when I'm building a single library that doesn't link with anything else.  In this scenario I can have a single target with three Build Configurations (Debug, Profiler and Release).  But what can I do when I build an Application that needs to link with the Debug, Profiler and Release libraries depending on what kind of build I'm doing?

This should work without any special effort, IF your projects are set up correctly. I had a few people ask me about this at WWDC, and they all had made the mistake of adding the library to the link phase of the application by referencing a file from the file system (using the Project menu's "Add to Project..." item), rather than using a product reference. Xcode will automatically use the Configuration-specific name for a file if it was included via a reference to a project (or to another target within the same project).

Here's an explanation of the "right" way to do this in Xcode, as I understand it. I'll assume here that your application and your library are in different projects (else-wise, you can just skip the first step).

First, make a reference to your library project from the application project - Open the application project, and use the Project->Add to Project... menu item to add a reference to the library's xcode project file. You should be able to accept the default settings for adding a file, but make sure that "Copy items into destinations group's folder" is NOT checked.

Now that you have a reference from one project to the other, you should set up a dependency on the library target from the application target. Double-click the application target in the Groups & Files view, and use the "+" button on the "General" pane to set the application as being dependent on the library.
(This isn't strictly necessary, but you'd normally want to have a dependency on the library, so if you change it, the application gets rebuilt, too.)

Final step - In the Groups & Files view, the referenced project is shown with a disclosure triangle. Click the triangle to show the products of the application project. Drag the library you want to link against to to the "Link Binary with Libraries" build phase of your application target. 

When you change the active configuration, the reference to the library should automatically change names to match the configuration (though the UI might not update everywhere immediately - a known bug).

-Mark

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Can you use Build Configurations to link with different libraries?
      • From: Mike Jackson <email@hidden>
    • Re: Can you use Build Configurations to link with different libraries?
      • From: Dave Thorup <email@hidden>
References: 
 >Can you use Build Configurations to link with different libraries? (From: Dave Thorup <email@hidden>)

  • Prev by Date: Re: Displaying Custom Data Types in Debugger
  • Next by Date: Re: Can you use Build Configurations to link with different libraries?
  • Previous by thread: Can you use Build Configurations to link with different libraries?
  • Next by thread: Re: Can you use Build Configurations to link with different libraries?
  • Index(es):
    • Date
    • Thread