通过.pro项目文件在Qt Creator中制作MAKEFLAGS [英] MAKEFLAGS in Qt Creator via .pro project file

查看:423
本文介绍了通过.pro项目文件在Qt Creator中制作MAKEFLAGS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的PC有4个内核,因此我想在编译时使用所有内核,我可以通过将 -j4 选项传递给编译器来实现。在Qt Creator中,我通过在 Build Environment 面板中添加一个环境变量来做到这一点,如图所示:

The PC I'm using has 4 cores so I wanna use all them while compiling, which I do by passing the -j4 option to the compiler. In Qt Creator I do that by adding an environment variable in the Build Environment panel, as shown in the images:

MAKEFLAGS = -j4

问题是该设置不会在我正在使用的PC中的所有项目中持续存在,这很酷。因此,我必须对每个项目至少执行一次。我认为这存储在 .pro.user 文件中,因为每次 .pro.user 被删除时, MAKEFLAGS = -j4 Build Environment 面板中消失。

The problem is that this setting doesn't persist across all projects in the PC I'm using, which will be cool. So I have to do that for each project at least once. I think this is stored in the .pro.user file, since every time .pro.user gets deleted the MAKEFLAGS = -j4 desapears from the Build Environment panel.

无法仅通过 .pro 项目文件添加此设置吗?

Isn't possible to just add this setting via .pro project file?

我对让我摆脱多次设置这些东西的必要性的任何方法感兴趣。

I'm interested in any approach which will allow me to escape from the necessity of setting that stuff multiple times.

给我一​​点背景,我在Windows上。

To give a little context, I'm on Windows.

推荐答案

您在寻找 .pro.shared 共享的项目设置。 c $ c>文件。它们完全是为您的想法而设计的。

You're looking for shared project settings in a .pro.shared file. They are designed exactly for what you have in mind.

将设置添加到 .pro 文件是错误的,因为该文件是可移植的,而不是绑定到任何特定的构建主机。

Adding the setting to a .pro file is wrong, since that file is meant to be portable and not tied to any particular build host.

这篇关于通过.pro项目文件在Qt Creator中制作MAKEFLAGS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆