• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Pass a C option based on command-line output?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pass a C option based on command-line output?


  • Subject: Re: Pass a C option based on command-line output?
  • From: Eduard de Jong <email@hidden>
  • Date: Wed, 11 Jan 2006 11:05:42 -0800

Title: Re: Pass a C option based on command-line output?
this is how i just did it:

1 select the source file that  needs this variable set
2 open its inspector
3 in the "Build" tab enter the compiler flag : -DHOST=`hostname`
4 close the inspector
5 build and run


Yet another problem may still exist if you want to use the defined macro as a string literal in the source file: it will need quotes as part of the definition, and i couldn't get Xcode to include quotes in the buildsetting that worked. I either got the compiler choking or the literal string: `hostname`..

 
Cheers
Eduard

At 17:46 -0500 07-01-2006, Daniel Jalkut wrote:
On Jan 7, 2006, at 4:34 PM, Chris Espinosa wrote:

Invoking random shell commands at any given step in an Xcode compilation would introduce unbounded complexity, and things are bad enough as it is.  Besides, you really don't need to backtick-execute a shell command to get the host name, it's already set in the shell's $HOSTNAME variable.

Yeah - but executing random shell scripts in a build phase also introduces unbounded complexity, right?  I don't know if you're gonna get away from that problem in a highly customizable IDE :)

So in Preprocessor Definitions just set HOSTNAME=$HOSTNAME and be done with it.

On my machine it looks like I have $HOST. But in any case I don't have any luck trying to set a build setting with the expanded value. I've tried:

HOSTNAME=$HOST
HOSTNAME=$(HOST)
HOSTNAME=${HOST}

(This is on the Preprocessor Macros build setting)

Is there a particular build setting where I can "promote" shell variables into Xcode variables? Or is there a different format I'm supposed to use to expand them in a build setting's definition?

Thanks!

Daniel

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
>.nl

This email sent to email@hidden


--
Eduard

  An optimist believes we live in the best of all possible worlds.
        A pessimist fears this is true.

UK: +44 787 627 2204 USA: +1 650 703 4608(M)  NL: +31 62 669 2972(M),
 _______________________________________________
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

References: 
 >Pass a C option based on command-line output? (From: Daniel Jalkut <email@hidden>)
 >Re: Pass a C option based on command-line output? (From: Chris Espinosa <email@hidden>)
 >Re: Pass a C option based on command-line output? (From: Daniel Jalkut <email@hidden>)

  • Prev by Date: Re: xcode 2.2 compiles .m file as C++
  • Next by Date: Re: Run Script Build Phase & Linking
  • Previous by thread: Re: Pass a C option based on command-line output?
  • Next by thread: Build with 10.4, run under 10.3
  • Index(es):
    • Date
    • Thread