Dependency Checking Woes
Dependency Checking Woes
- Subject: Dependency Checking Woes
- From: Rush Manbert <email@hidden>
- Date: Thu, 16 Mar 2006 16:55:13 -0800
The setup:
I have two Xcode projects.
MyLib.xcodeproj builds a static library.
The Debug and Release build configurations generate differently named
files, as shown:
Debug config output: /CommonBuildProducts/Debug/libMyLib_dbg.a
Release config output: /CommonBuildProducts/Release/libMyLib_rel.a
MyApp.xcodeproj builds an application that links with the MyLib static
library.
The Debug and Release configurations need to link against differently
named library files:
Debug config links against: libMyLib_dbg.a
Release config links against: libMyLib_rel.a
In MyApp, I only want to have one target. The fact that I need to link
against different libraries in the different configurations leads me to
specify the link library names using -lMyLib_dbg or -lMyLib_rel on the
"Other Linker Flags" setting. In the same fashion, I specify the unique
library search paths differently for the two build configurations.
In the real case, this is all done with configuration files, but I'm
hoping that is immaterial here.
My target in MyApp has a direct dependency on the single target that
exists in MyLib.xcodeproj. If I do a fresh checkout of my source code
tree, open MyApp.xcodeproj in Xcode, and tell it to build, it first
builds the static library in the proper build configuration, then builds
the app and links against the library. Great!
Now comes the bad part. If the MyLib library gets rebuilt and I tell
MyApp to build, but nothing has changed in MyApp, the MyApp project does
not recognize that it needs to relink against the newer library version.
This is a Bad Thing.
I can understand why this is happening. I never added the library to the
project. How can I expect the dependency analysis to know about it?" But
I can't add the library to the project, because my single target in
MyApp needs two different libraries, that have different names,
depending on whether we are building the Debug or Release configuration.
If I add both to the target, then Xcode wants to link against both of them.
Maybe I shouldn't name the library differently, just make it be
libMyLib.a in both cases. If I did that, then I can add both of them to
the project, but I need to add both of them to the same target. Then
when I build, Xcode again tries to link against both libraries. I can't
add a library to a particular build configuration within a target. (I
could add just ONE of the libraries to the project/target, but then the
dependency checking would only work for the build configuration that
matches the library I added. It would still fail for the other build
configuration.)
Once again, in the real case, I am linking against a lot of libraries,
some of which have different names in debug vs. release, others that
also throw in threading model-specific naming, etc., and some that
always have the same name. It's very complicated and it works out very
nicely to set it all up with configuration files. It's easier and less
error-prone to setup a new project that way, because you don't need to
manually add the correct libraries to the correct targets.
So after all this, my question boils down to this: Is there some way to
make my app project know that the static lib it depends on has changed
and to have it relink, even if the static lib has not been added to the
project? I'm hoping that one of the Apple Gods of Xcode can help me out
here.
Alternatively, should this be a bug report/enhancement request?
Regards,
Rush
_______________________________________________
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