3

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

enter image description here

enter image description here

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.

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.

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

KcFnMi
  • 5,516
  • 10
  • 62
  • 136
  • Just set the `MAKEFLAGS` environment variable to `-j4` see [setting default make options for qt creator](http://stackoverflow.com/questions/8860712/setting-default-make-options-for-qt-creator) – kenba Jul 19 '16 at 16:15
  • 1
    The accepted answer there relies on `.pro.user`, so it will not persist forever. – KcFnMi Jul 19 '16 at 16:26
  • Yes, but the author of the question could not "unaccept" the answer, so he edited his question to recommend setting the `MAKEFLAGS` environment variable... However, if you want a persistent version of `.pro.user` you could use `.qmake.conf` instead. – kenba Jul 19 '16 at 17:28
  • 1
    Interesting, didn't know about `.qmake.conf`. Even so it's not clear to me how it'll help in answering the question, perhaps someone could. – KcFnMi Jul 20 '16 at 11:59
  • This is an X-Y problem question: You shouldn't presume that a particular solution (e.g. modifying MAKEFLAGS) is the answer. Instead, you should ask a more general question of how to share a particular project settings across projects you open. Had you googled that, you'd have found the answer yourself, too :) – Kuba hasn't forgotten Monica Aug 16 '16 at 20:13

1 Answers1

2

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

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.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313