• 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: Adding debug/release dylib to respective Configurations in XCode.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding debug/release dylib to respective Configurations in XCode.


  • Subject: Re: Adding debug/release dylib to respective Configurations in XCode.
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 15 Oct 2008 04:08:27 -0500

On Oct 15, 2008, at 2:06 AM, Dan Ribe wrote:

I have a XCode project which has one Target as "ProjectName" & Two configuration as Debug & Release. I want to include a .dylib in my project such that Debug configuration include the Debug dylib & Release configuration include the Release version of dylib.

I can think of doing this by creating new targets like "ProjectName_Debug" & "ProjectName_Release".

Is there any other way also to do the same thing without creating the new targets ?

The build phases of targets, and their member files, can not be made to change based on the configuration.


There are a couple of possible solutions:

1) Don't put the library into the link phase as a member. Instead, add it to the link command using the Other Linker Flags (OTHER_LDFLAGS) build setting. That setting can be made to vary based on the configuration. The form of the flag would be "-l<lib>", where <lib> is the name of the library without its "lib" prefix or its ".dylib" extension. You might need to provide the directory containing the library with the LIBRARY_SEARCH_PATHS build setting.

2) If the library is the product of another Xcode project, use the cross-project reference feature of Xcode. The project for your app (or whatever ProjectName is) would have a reference to the project file for the library. The project for the library would have configurations which matched the configurations of ProjectName. The ProjectName target would have a dependency on the library target in the library project. Lastly, the ProjectName target's link phase would include a reference to the product of the library target (i.e. the library).

In this configuration, Xcode will automatically use the library built from the matching configuration -- the Debug library for the Debug build of ProjectName and the Release library for the Release build of ProjectName.

Search for "cross-project reference" in the Xcode documentation for details.

Cheers,
Ken

_______________________________________________
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


References: 
 >Adding debug/release dylib to respective Configurations in XCode. (From: "Dan Ribe" <email@hidden>)

  • Prev by Date: Adding debug/release dylib to respective Configurations in XCode.
  • Next by Date: Re: Undefined symbols: "_fputs$UNIX2003", referenced from:
  • Previous by thread: Adding debug/release dylib to respective Configurations in XCode.
  • Next by thread: int128_t
  • Index(es):
    • Date
    • Thread