开发者

How to set build options (-D) dynamically in XCode?

I'm porting a project to be built with MacOS. We compile the current source re开发者_运维百科vision number into our code which is used to track version compatibility between files and libraries at a code level.

-DSRC_REVISION=12345

In our existing build system 12345 is output (as text) by a script called by make and turned into a build option each time make is run.

How might I do the same in XCode.


Can you just use a #define in a .h file instead of doing a -D on the compile?

Change your script to write a "version.h" consisting of:

#define SRC_REVISION 12345

and then include that file in each of your source files (or set it up as a prefix header so you don't have to explicitly include it in every file).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜