xcode : linking with "Current" version of a framework
I am compiling a framework that depends on another framework. I have trouble when distributing my framework to other users that doesn't have necessarily the same versions than on my machine. It seems that xcode creates a "hard-link" to the last version installed on my system. "otool -L" on my framework reports a link to :
gecode.framework/Versions/19/gecode (compatibility version 19.0.0, current version 19.0.0)
A possible (and working) solution is to change the path of the linked framework with the install_name_tool command :
`开发者_JAVA技巧install_name_tool -change gecode.framework/Versions/18/gecode` gecode.framework/Versions/Current/gecode my-constraints-framework
But is there a simple way to tell xcode to link directly against the "current" version of the framework during the build phase ?
The "compatibility version" of the framework should not change for compatible versions. If "18" changes to "19" that means, the new framework is not compatible: code that linked to "18" cannot use "19" without recompilation/modification.
The usual way to resolve this problem on Mac OS is to copy the framework into the bundle where it is needed and to link to it using the @executable_path.
精彩评论