I have a project in which I need to produce two executables, one in 64-bit (x64_86) and the other in 32-bit (i386); they cannot be combined.
The project includes linking to a 3rd party framework.
Compilation in XCode works without issue.
When using xcodebuild on its own (no parameters passed), the 64-bit binary is built as expected and the 3rd party framework is linked in with the correct reference. Using otool -L shows
@rpath/Frameworks/thirdpartybundle.framework/Versions/A/thirdpartybundle
However, when I compile the 32-bit binary, the referenced framework is wrong and otool -L shows this: -
@rpath/Frameworks/mytool32.framework/Versions/A/mytool32
Where 'mytool32' is the product name passed to xcodebuild. I've tried building the 32 bit versions with the following commands: -
xcodebuild -project mytool.xcodeproj -scheme mytool VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO ARCHS=i386 PRODUCT_NAME=mytool32
And I've also tried this: -
xcodebuild -project mytool.xcodeproj -destination 'platform=OS X,arch=i386' -target mytool PRODUCT_NAME=mytool32
Either way, they both produce a binary with the wrong path to the framework, substituting the product name instead of the framework name.
How can I build the 32-bit version using xcodebuild, specifying the product name, but with the correct paths to the third party framework?