Re: How to set executable/product name by compiler switch?
Re: How to set executable/product name by compiler switch?
- Subject: Re: How to set executable/product name by compiler switch?
- From: Roland King <email@hidden>
- Date: Fri, 8 Jan 2010 22:01:57 +0800
Your original mail was quite short so may I just ask if I have this right. You have a bunch of #ifdef _CUSTOM_VER in the code of your application and you set this (or not) in your pch file and you want the build product to be one thing if the macro is set, and one if it is not set. Is that correct?
If so, Ken is giving you I think good advice and will actually be easier to implement. Currently if you want to build app1 you have to go edit your code and undefine the line, and if you want to build app2, you have to edit the code and put it back, and you still can't at this point automate the building of two different products.
In a way you *do* need different build settings because the name of the thing you build is one of the build settings (I believe it's called Product Name). What you can also do in build settings is set #defines without having to put it in code and edit it in and out.
There are a couple of ways you could actually accomplish what you want, one is to add an extra Target, the other is to add extra Configurations. The build settings for say Target1 would not have the define in them and would build Product1, the build settings for Target2 would set the define (I think you'd use the Other C Flags with a -d for that) and would build Product2. Instead of having to edit your code, you would just select a different target or configuration in that main dropdown box near the top left of the screen and it would build.
I think I'd probably add extra configurations myself, you can copy from Debug and Release to get Debug Custom and Release Custom, then you just change the Project Name setting, add your CFLAG in those two settings and with a little tinkering you should be good to go. The reason I suggested extra configs instead of extra targets is that the build directories for the configs will be separated and, since your code changes depending on the flag, you sort of want this.
On 08-Jan-2010, at 9:20 PM, Alexander Bokovikov wrote:
>
> On 08.01.2010, at 17:45, Ken Thomases wrote:
>
>> In Xcode's project and target build settings, you can define your own build settings.
>
> I'm sorry, but I don't understand this approach. I don't need different _build_ settings for different products. I already have #ifdef / #else / #endif clauses set in several modules of my project. Build settings are just the same regardless to the precompiled variable setting. It's unclear for me, how build settings can affect to my precompiled variable.
>
>> Then, you can add a macro definition to the pre-existing Preprocessor Macros build setting and base it on your custom build setting.
>
> I believe you understand what you're talking about, but as for me, I'm not. Could you please describe it with an example? I never wrote such macros and don't know where and what to write.
>
> Thank you for your help!
>
> Best regards,
> Alex
>
> _______________________________________________
> 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
_______________________________________________
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