设置 Qt Creator 的默认 make 选项?
我如何覆盖默认的 make 参数,即:
make -w
每次创建项目时,我都必须修改项目设置,添加 -j4
来 make 参数。
我可以默认设置 make -w -j4
吗?
编辑
最好的方法是设置 MAKEFLAGS 环境变量,我选择唯一的答案作为最好的答案,仅关闭此线程。
要为 UNIX 设置此选项,请修改 Qt Creator 的 *.desktop 文件,在标题为 Exec=
的行前添加 env MAKEFLAGS=-j4
,但请注意,您不会这样做设置为多线程后,无法立即停止 QtCreator 中的构建。
How can i override default make parameters , which is:
make -w
Each time i create a project , i had to modify project settings , adding -j4
to make parameters.
Can i set make -w -j4
by default ?
EDIT
The best way to do this is setting MAKEFLAGS environment variable , i'm picking the only answer as the best only to shut this thread down.
To set this for UNIX, modify the *.desktop file of Qt Creator , prefix the line entitled Exec=
with env MAKEFLAGS=-j4
, but be aware that you won't be able to cease building in QtCreator immediately after setting to multithread.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
要使其全局且永久,请转到
并填写预定义的环境设置:
MAKEFLAGS=-j4
To make it global and permanent go to
and fill your predefined env settings:
MAKEFLAGS=-j4
在 qtcreator 中,转到“项目选项卡”并根据需要设置“创建参数”:
In the qtcreator go to the "Projects tab" and set "Make arguments" as you like:
如果您希望每次创建新项目或打开某个项目时都将
-jx
参数设置为默认值,则必须将环境变量MAKEFLAGS
添加到系统,其值为-jx
。例如,在 ubuntu 的 8 - 线程编译中,可以通过添加来实现此选项
到 /etc/enviroments
结果将是:
If you want
-jx
parameter to be default each time you create a new or open some project, you must add enviroment variableMAKEFLAGS
to your system with value-jx
.For example, at ubuntu for 8 - threding compilation this options can be realized by adding
to /etc/enviroments
Result will be:
在尝试实现问题中描述的修复后,我最终发现了以下内容(显然这只是使用 .desktop 文件的 freedesktop 概念的 Linux 解决方案):
“/usr/local/share/applications/Nokia-QtCreator”中的行.desktop”是:
我将其更改为:
并获得了问题中请求的功能。
好吧,我不知道为什么按照问题中的说明我没有到达那里,但我没有。我希望这个解释对某人有所帮助。
After attempting implement the fix described in the question I eventually found the following (clearly this in only a solution to linux's that use the freedesktop concept of .desktop files):
The line in "/usr/local/share/applications/Nokia-QtCreator.desktop" was:
I changed it to:
And got the functionality requested in the question.
Ok, I have no idea why following the instructions in the question I didn't get there but I didn't. I hope this explanation will help someone.