Xcode adds $CURRENT_VARIANT to executable filename (except normal)

I am trying to include a fat (x86 simulator and iOS device) static library from third party, which comes as normal and debug variants.

We have 5 different configurations, of which 2 are debug (unit_test and debug) and 3 are normal (distribution, ad_hoc, internal_test).

So I set Build Settings => Build Variants (where iOS Default is "normal") to "debug" for the 2 debug configurations, then changed the Library Search Path to end with $CURRENT_VARIANT, and finally put the two 3rd-party libs (with identical name) in sub-folders named "normal" and "debug".


Linking worked as intended -the lib itself was referenced as "-lthirdpartylib" and the Ld command had either "-L~/thirdparty/library/debug" or "-L~/thirdparty/library/normal" as search path, and the app was built...


However, the debug version couldn't be launched. When trying to invoke the simulator, Xcode gave an error message "The file your.app couldn't be opened because you don't have permission to view it."


I examined the built executable and found that the bundle filename was "your.app" as usual, but the UNIX executable file inside was named "your_debug" instead of just "your". When I renamed the executable "your_debug" to "your", then tried to debug again from Xcode, the file "your_debug" was built again, but then Xcode launched my app in the simulator, from the renamed file "your" I suspect...


To me it looks like an Xcode bug - I never specified the output file name to end with $CURRENT_VARIANT.

I examined the project.pbxproj file with TextEdit, and couldn't find any other reference to the debug variant.


Anyone else seen this before?

I'll file a bug against Xcode anyway.


Other suggestions to include debug and normal variants of a fat 3rdparty lib in a project with custom configurations?

found a workaround:

rename debug lib to libThirdPartyDbg, then added "Other Linker Flags" to either "-lThirdParty" for the normal targets and "-lThirdPartyDbg" for the debug targets. And of course removed the Build Variants which cause Xcode to mangle the output filename...

This Xcode bug has absolutely nothing to do with libraries (being fat or not). It can be reproduced without including any library: Take a sample project (e.g. PageControl), go to Build Settings, change the Target Settings => Build Variants from "normal" (iOS Default) to "debug", then compile and run the sample. Xcode just gives an error message and cannot launch the built app in the simulator. And the reason for this is that the Unix Executable is not named "PageControl", but "PageControl_debug".

Xcode adds $CURRENT_VARIANT to executable filename (except normal)
 
 
Q