问题描述
我想同时使用InnoIDE和ISCC / ISPP,不同之处在于我想传递一个参数,该参数将覆盖脚本中的#define。
I would like to use both the InnoIDE and ISCC/ISPP, the difference being that I would like to pass in a parameter, which will override a #define in the script.
在命令行中,我可以传递/ Dmyarg = myvalue。与脚本中的 #define myarg myvalue相同。
In the command line I can pass /Dmyarg=myvalue. That is the same as "#define myarg myvalue" in the script.
遗憾的是,脚本的优先级高于命令行值。我知道,就像我尝试过的那样。我显然可以注释掉脚本中的#define,并且命令行定义可以使用,但是然后我将无法使用IDE进行构建。
Sadly, the script takes precedence over the command line value. I know, as I tried. I can obviously comment out the #define in the script and the command line define will work, however then I will not be able to use the IDE to build.
是吗可以在InnoIDE中为项目的某个地方设置#define还是有某种方法让命令行#define优先?
Is it possible to set a #define inside InnoIDE somewhere for the project or is there some means to have the command line #define take precedence?
推荐答案
在您的脚本中,执行以下操作:
In your script, do something like this:
#ifndef myarg
# define myarg "mydefault"
#endif
现在,如果您在IDE中进行编译或使用命令行而不指定/ Dmyarg = something,则它将使用脚本中指定的默认值。否则,如果您确实在命令行上指定了某些内容,则它将使用该内容。
Now, if you compile in the IDE or if you use the command line without specifying /Dmyarg="something", then it will use the default specified in the script. Otherwise, if you do specify something on the command line then it will use that instead.
这篇关于Inno Setup IDE和ISCC / ISPP传递定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!